Jump to content

Wiring the 'N' terminal inside a For Loop


Recommended Posts

Our local users' group last night had a presentation based on the Tips and Tricks to Speed LabVIEW Development session from NIWeek. Since I missed that one at the conference, I went. On one of the slides, there was a new (to me) tip that wasn't part of the presentation.

You can use the N terminal of an auto-indexing For Loop as a proxy to the size of the (smallest) incoming array. All these years, I've been manually calculating the Array Size outside the loop!

post-2992-1189602836.png?width=400

Of course, it's obvious now that I've seen it. Am I the last person in the world to learn this? :lightbulb:

EDIT: This was supposed to go in the LabVIEW (General) forum, but in my excitement I posted it in the wrong place. :(

Link to comment
  • Replies 70
  • Created
  • Last Reply

Top Posters In This Topic

QUOTE(Justin Goeres @ Sep 12 2007, 09:17 AM)

...

Of course, it's obvious now that I've seen it. Am I the last person in the world to learn this? :lightbulb:

...

I reacted the same way when I saw someone wire an enum to a format into string. I thought it was great but everyone else said "You didn't know that?"

I think this is not our short-coming but rather due to the sparse upgrade notes. I religeously read every one of these cover to cover and still I miss stuff.

WE really need EXHAUSTIVE upgrade notes!

Ben

Link to comment

QUOTE(Ben @ Sep 12 2007, 09:40 AM)

I reacted the same way when I saw someone wire an enum to a format into string.

@Ben: Could you tell me what is the format into string VI? :) I don't know about this :P . I have to you the property strings[] and array indicator to get the string of an enum.

@All: You guys are experts in LabVIEW, so if you have time, it's really helpful if you can list down these tricks in VI. I really want to learn more about these stuffs. It's hot :thumbup: .

Thang Nguyen

Link to comment

QUOTE(crelf @ Sep 12 2007, 08:06 AM)

There's a better way? :blink:

This gives me an idea for kind of a cool thing to do. Not a Coding Challenge exactly, but more like a Cleverness Festival! :beer:

We could pick an interesting trivial problem (Array Size is a really good one) and challenge LAVA members to find original (not optimal) ways to solve it. We could constrain it with a few simple rules like

  • Must not use any subVIs except those provided in vi.lib or OpenG.
  • All code must fit in a block diagram window of a certain size (and no stacked sequences!)
  • All code must obey basic LabVIEW style conventions

or whatever. I'm just brainstorming here. Might be fun to see what's lurking in the corners of our brains.

Link to comment

QUOTE(Thang Nguyen @ Sep 12 2007, 11:31 AM)

Welcome to The Cool Kids' Club: :P

http://lavag.org/old_files/monthly_09_2007/post-2992-1189622895.png' target="_blank">post-2992-1189622895.png?width=400

Format Into String is in your String palette.

BTW, there's a more versatile Get Strings from Enum function in the OpenG Data Tools library. It takes a variant as input, so you're not limited to using it with just one enum.

Link to comment

QUOTE(tcplomp @ Sep 12 2007, 03:17 PM)

RE: My array size example

"If you want people to respond, say something rediculous." (Ben)

The Interesting Stuff thread that Yen started on NI has lot of links to LV trivia.

For obfuse code see the thread that Christian started. It has examples that range from the simple to the subtle.

Ben

Link to comment

QUOTE(Justin Goeres @ Sep 12 2007, 02:49 PM)

Welcome to The Cool Kids' Club: :P

post-2992-1189622895.png?width=400

Format Into String is in your String palette.

BTW, there's a more versatile Get Strings from Enum function in the OpenG Data Tools library. It takes a variant as input, so you're not limited to using it with just one enum.

I think an even lesser known trivia is to use Scan from String to read an enum string

post-447-1189626665.png?width=400

Link to comment

QUOTE(Justin Goeres @ Sep 12 2007, 08:17 AM)

Of course, it's obvious now that I've seen it. Am I the last person in the world to learn this? :lightbulb:

I believe I can authoritatively say no, you weren't the last. Now, am *I* the last person in the world to learn this?

For some reason, I knew you could wire the N terminal inside a For loop, but doing it in the case of an auto-indexed loop never occurred to me.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.