Certification

cancel
Showing results for 
Search instead for 
Did you mean: 

CLAD Prep Guide Q8 Programming Fundamentals

Solved!
Go to solution

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!

 

 

0 Kudos
Message 1 of 4
(4,194 Views)
Solution
Accepted by topic author jesLVbcn

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(4,177 Views)

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!

0 Kudos
Message 3 of 4
(4,172 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 4
(4,167 Views)