08-31-2009 09:46 AM
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:
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.
08-31-2009 04:35 PM
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.
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?
08-31-2009 05:21 PM - edited 08-31-2009 05:21 PM
08-31-2009 05:44 PM
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.Message Edited by smercurio_fc on 08-31-2009 05:21 PM
It certainly narrowed it down!
09-01-2009 04:15 AM
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,
09-01-2009 08:48 AM
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.
09-01-2009 09:54 AM
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,
09-01-2009 10:04 AM
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.