LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Darren's Weekly Nugget 04/10/2006

This week's nugget pertains to a cool new feature in LabVIEW 8.0 that I just discovered last week.  The Format Into String function now allows you to specify a different order for the inputs to appear in the formatted string than the order you wire them into the function.  For example, if you had four strings wired into the Format Into String inputs, and your format string was "%s %s %s %s", then the output string would just be those four strings in the order they were wired.  But as you can see in the screenshot below, there is now a way to specify the order of the inputs in the format specifier.  In the example below, by using the "%n$s" specifier, where 'n' is the position of the wired input, you can dynamically change the position of inputs in the output string.  Try it out!
 
 
-D

P.S. - Check out past nuggets here.

Message Edited by Darren on 04-10-2006 10:50 AM

Message 1 of 13
(12,529 Views)

Hey, this is cool!!

Of course with a fixed format string as in the above example, we might as well wire the inputs in the desired final order. 😉

The new feature starts to shine once we generate or select the format string programmatically. 😄

Message 2 of 13
(12,511 Views)
This feature is indeed cool and I'll have to move to 8 be use it (if I can rmember it of course Smiley Sad)

... but why does it start from 1 and not from 0 Smiley Surprised ??

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 3 of 13
(12,507 Views)
If you look at the context help for Format Into String, you'll see that the input names are "input 1, input 2, ..., input n".  The format specifier is simply being consistent with the input names.
 
-D
Message 4 of 13
(12,510 Views)
Ok, 1-0 for you Darren... Smiley Very Happy I didn't see that...

I won't ask why input names start from 1 and not from 0 Smiley Wink

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 5 of 13
(12,506 Views)


@altenbach wrote:

Of course with a fixed format string as in the above example, we might as well wire the inputs in the desired final order. 😉


Nice to learn new features.

Maybe CC can use this to add more randomness and variety for his automated congrats tool.  Mixes up the messages as well as provide alternative bits of text..

😄

Message 6 of 13
(12,469 Views)
Hey that's just cool.

"Small" changes like this can really simplify certain types of code.

I'm (still) looking forward to working with LV 8.....

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 7 of 13
(12,413 Views)

cool one.

can think of quite a few creative uses of this feature!

0 Kudos
Message 8 of 13
(12,408 Views)
Ok!
 
LabVIEW 7.1?

帖子被jwdz在04-11-2006 10:16 PM时编辑过了

" 一天到晚游泳的鱼"

labview@263.net

我的个人网站:LabVIEW——北方客栈 http://www.labview365.com
欢迎加入《LabVIEW编程思想》组——http://decibel.ni.com/content/groups/thinking-in-labview
0 Kudos
Message 9 of 13
(12,393 Views)
Nice feature! Does it allow repeat and omission of inputs?


LabVIEW, C'est LabVIEW

0 Kudos
Message 10 of 13
(12,371 Views)