LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

parsing a string

July 17

 

Group:

 

I am displaying  a string of thermocouple data (ni-9213 module) using Labview 2014 in a text box.  The output looks like the following:

 

7/17/2015 9:54:17 AM72.616310 0.00000072.692420 0.00000072.601004 0.00000072.197581 0.00000072.569151 0.00000072.518680 0.00000072.735436 0.00000073.559346 0.000000

 

I would like the output to look like this:

 

07-17-2015  09:54:17   72.62  72.69  72.60   72.20  72.57   72.52  72.73   73.56

 

 

any suggestions on where to start?

 

thanks

 

0 Kudos
Message 1 of 14
(4,268 Views)

Show the code that you're using to pack the string indicator.

This should just be a matter of using the format string and the Format Into String function.

I don't recall the timing formatting but your floats look like a straightforward %.2f.

0 Kudos
Message 2 of 14
(4,228 Views)

July 17

 

Taki

 

Thanks for your interest.  the screen shot of the block diagram is attached.

0 Kudos
Message 3 of 14
(4,202 Views)

7/17/2015 9:54:17 AM72.616310 0.00000072.692420 0.00000072.601004 0.00000072.197581 0.00000072.569151 0.00000072.518680 0.00000072.735436 0.00000073.559346 0.000000

 

07-17-2015  09:54:17   72.62  72.69  72.60   72.20  72.57   72.52  72.73   73.56

 

 


It looks like you are getting 2 values for each reading. Are you sure there is not some type of control code in front of the 72s and 73 at the start of each temp value? Like a TAB that we can not see in the string that you posted?

This would be very easy if there was some control code in front of your readings

parsing a string.png

Omar
0 Kudos
Message 4 of 14
(4,195 Views)

Post your VI or a Snippet of your code and not a screen shot.

 

But if you add a space or TAB before or after your format string "%f %f" that will make it very very easy to pull out your reading.

 

use something like "%f\s%f\s" 

 

Your readings are running together from the for loop.

 

Omar
0 Kudos
Message 5 of 14
(4,192 Views)

Let get ride of the extra 0.000 before they get into your string.

 

Are you reading multiple channel?

Your DAQmx Read is configured for a 2D array. Reading multi channel multiple time for each read. There is here the extra 0.000 is coming from.

 

Without knowing what your configuration, but from what it seems you are logging, I assume you have 8 thermocouple and you wish to take a temp readings from each every 10 sec. But you only want to take a single reading from each every 10 sec.

 

If that is the case, you should configure the DAQmx for Multiple Channel Single Reading (Analog 1D DBL NChan 1 Samp)

 

parsing a string.png

Omar
0 Kudos
Message 6 of 14
(4,167 Views)

july 17

 

Omar:

thanks for your help.  Attached is the actual vi that i'm working on.

 

would you please tell me what the 2 middle icons in your vi represent?

 

tom

0 Kudos
Message 7 of 14
(4,139 Views)

You can paste the snippet onto your block diagram

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x2PkCAI&l=en-US

 

Just one of many ways to format your log data

"Number To Engineering String"

"Array To Spreadsheet String"

 

But, are you only wishing to read 8 thermocouple only once every 10 sec?

Omar
0 Kudos
Message 8 of 14
(4,123 Views)

 

So from your Physical Channel

"cDAQ1Mod1/ai0:7" I assume you really only want one reading from each every 10 sec?

 

Configure your DAQmx Read for "NChan 1 Samp"

 

 

Omar
0 Kudos
Message 9 of 14
(4,111 Views)

July 17

 

Omar:

your snippet works!

 

here's the output

 

07/17/2015 19:25:37 73.74 -1015 73.99 73.88 73.68 73.43 73.62 73.45

 

When complete, we'll be measuring 32 tc leads.  And yes we take 32 readings every log.

 

currently the data scrolls to the screen, when the next log is sent to the screen the first set of reading disappears.  How can i have serveral logs appear on the screen before they are scolled off?

0 Kudos
Message 10 of 14
(4,095 Views)