07-18-2018 08:18 AM
Hi All,
I would appreciate help with this question. The VI should log every sample above the threshold value to a txt file. I attach the image of the 4 possible solutions.
My assumptions:
Option A has the low level I/O functions Open/Create/Replace File and Close File inside the FOR Loop so the log file will be replaced and closed on each iteration for each value above the threshold. The log file will contain only the last value above the threshold.
Option B seems to work
Option C is the correct answer
Option D is not correct because it will log all the values below the threshold
Why B is not correct?
Thank You!
Solved! Go to Solution.
07-18-2018 09:10 AM - edited 07-18-2018 09:11 AM
There is one fine detail in there: the Format Into String is adding a comma (,) to the end of the data string. You can't see this in the image you supplied, but zoom in on the PDF and you will see it. This adds what is called a delimiter between the values.
So look at these two strings and tell me what the values are. You cannot tell when a value begins or ends in the first one (B). But you can with the second (C) because of that comma separating the values.
Personally, I would have made the format "%f\n", which would put each value on its own line.
07-18-2018 09:30 AM
Hello,
I see the difference in the log file. My questions now are:
Is there any way to use delimiter in the Number to Fractional String?
Which rule do you have to use Format into String or Number To Fractional String?
Thanks!
07-18-2018 11:52 AM
@jesLVbcn wrote:
Is there any way to use delimiter in the Number to Fractional String?
Which rule do you have to use Format into String or Number To Fractional String?
No
A simple rule: If you just need the number in a string, use the Number To Fractional String. If you need any type of additional formatting (extra characters, additional inputs, etc) then use Format Into String. You can use the Format Into String to avoid a lot of Concatenate String.