LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI of the Day (8/31/2009)

Today's function is a bit of a mystery.  I figured it was a good time to brush up on format strings and I was perusing the Format Specifier Examples.  The variable order is very interesting, and according to the help description you should be able to do something like this:

 

MysteryFunction.png 

 

The mystery is which function gives the results described.  I have LV 8.2.1 in case the examples have changed slightly.

 

As usual, the groundrules for VIOTD can be found here

Message 1 of 8
(3,614 Views)

Probably a little too sneaky by wiring the string incorrectly.  The function I had in mind was "Format Into String" and the variable order refers to the pull-down input terminals.

 

FormatIntoString.png

I like this function when I have a mix of numeric and string inputs, when I am going to repeat one of the values (looks better than branching wires with concatenate strings), or when I need to shuffle the order programmatically (I change the format string as necessary). 

 

Easy bonus question for kudos:  What is the resulting string in the following case?

 

FormatIntoString2.png

0 Kudos
Message 2 of 8
(3,550 Views)
I think having a constant labeled "format string" and an indicator labeled "resulting string" was kind of a dead give-away of which function you had in mind. Smiley Wink
Message Edited by smercurio_fc on 08-31-2009 05:21 PM
Message 3 of 8
(3,536 Views)

smercurio_fc wrote:
I think having a constant labeled "format string" and an indicator labeled "resulting string" was kind of a dead give-away of which function you had in mind. Smiley Wink
Message Edited by smercurio_fc on 08-31-2009 05:21 PM

It certainly narrowed it down!  Smiley Happy

0 Kudos
Message 4 of 8
(3,528 Views)

Hi Darin,

 

You made me think... I didn't find since I tried with one single input string...

 

@all: do you have any link/example that would show indepth use  of format strings. Each time there is a new thread about using them, I learn some use of them, but I would like to have an extended example of them.

 

Regards,

0 Kudos
Message 5 of 8
(3,500 Views)

Mathieu Steiner wrote: 

@all: do you have any link/example that would show indepth use  of format strings. Each time there is a new thread about using them, I learn some use of them, but I would like to have an extended example of them.


The various format strings and examples can be found in the LabVIEW Help. When looking at the help for the Format Into String function click on the link "format string" which is the description for the format string input. This leads you to a page explaining the format. A link near the end of that page leads you to examples.

0 Kudos
Message 6 of 8
(3,463 Views)

smercurio_fc wrote:

Mathieu Steiner wrote: 

@all: do you have any link/example that would show indepth use  of format strings. Each time there is a new thread about using them, I learn some use of them, but I would like to have an extended example of them.


The various format strings and examples can be found in the LabVIEW Help. When looking at the help for the Format Into String function click on the link "format string" which is the description for the format string input. This leads you to a page explaining the format. A link near the end of that page leads you to examples.


Thanks.

I have been reading this before, but there is no better example than code (this may be a personnal point of view)

I'll look into more details by myself

 

Regards,

0 Kudos
Message 7 of 8
(3,437 Views)

Personally, I think the examples of the Format Strings is very useful.  I would recommend that you try each of them out if you'd like to sharpen your formatting skills.  Most of my formatting involves fixed width floats, fixed precision floats, zero padded decimal numbers and space padded strings.  If you master these you'll be ready to format almost anything.

 

Coding is a good way to learn, that is why I am encouraging you to write a VI each day to explore something new.  An even better way to learn is from making mistakes while coding which is why I try (when I can) to trick you.

 

A search of the forum for 'format string' should give you plenty of other peoples' mistakes to learn from as well.

0 Kudos
Message 8 of 8
(3,432 Views)