LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying timestamped data on a graph

Hi meetrajesh,

 

because you did something wrong with your format string!

check.png

Do you spot the difference in your format string and the "element" string?

Hint1: there is a difference between a SPACE and a TAB char…

Hint2: ALWAYS show the display style indicator for string controls/indicators/constants when you are not using the default style!

Hint3: Read the help for those format codes! There is a difference in using %m and %M in a timestamp!

 

Solution:

check.png

 

Did you even read my message #2 (carefully)?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 11 of 17
(682 Views)

Oops I am so sorry for the bad format feed. Now the vi is working correctly but as you can see, it is displaying the data values of first sample only. How can I get the values of all the samples so that I can plot them on a graph wrt the time?

 

 And in your message #2 you mentioned that we can do this with Read Delimited Spreadsheet in string mode also. How can I do that?

0 Kudos
Message 12 of 17
(672 Views)

Hi meetrajesh,

 

How can I get the values of all the samples so that I can plot them on a graph wrt the time?

When you want to repeat some piece of code several times you should use a loop.

This is very basic programming stuff, and not even related to LabVIEW alone…

 

we can do this with Read Delimited Spreadsheet in string mode also. How can I do that?

Convert your file into a 2D array of strings. Then parse each column with the required format string for that column. (You need a different format string for the timestamp than for the signal values.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 17
(668 Views)

Yup everybody knows that a loop should be used to iterate the things, but this won't work here. 😞
Its the 'index' terminal of the 'Index Array' function which has the control of output. In the text file, the timestamped data points are saved at index 0, 2, 4 and so on (odd numbers are invalid because of the empty lines).

0 Kudos
Message 14 of 17
(664 Views)

Hi meetrajesh,

 

but this won't work here.

Why should it not work? Why so sad?

 

Its the 'index' terminal of the 'Index Array' function which has the control of output.

Yes, but loops can also use autoindexing in LabVIEW…

 

In the text file, the timestamped data points are saved at index 0, 2, 4 and so on (odd numbers are invalid because of the empty lines).

Yes - because of your "unoptimized" way of writing those data…

Well, in a loop you also can access the loop iterator. It will give you numbers starting from 0 and counting up: 0, 1, 2, …

What about a little magic commonly called "math" and double that iterator value to get 0, 2, 4… ???

Hey, with some more "math" you can even calculate how many iterations you need to process the full array!

 

All those questions aren't LabVIEW related, but show some lack of knowing how to develop an algorithm. I usually suggest to use a pen and paper for developing algorithms - before starting to code…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 17
(662 Views)

Hi meetrajesh,

 

please don't ask by PM for your problems in this thread. Just post here!

 

Hello Sir.. I am totally messed up with the things and I don't know why my mind has stopped working (maybe because of the pressure my boss has build up on me). Can you plz help me out with the vi to read and display that unoptimized text file on a graph. What things should I keep inside that loop? How that loop would work if 'Scan From String' is outputting only three single data values (and not a group of values). I am working on Labview 2017. I would be very thankful to you.

Use a loop:

check.png

 

Btw. you already got a suggestion in message #10! Why don't you use that?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 16 of 17
(651 Views)

@GerdW wrote:

 

 

Btw. you already got a suggestion in message #10! Why don't you use that?


I wonder that too.   I think sometimes people don't bother reading the messages we take our time to write, and are narrowly focused on some detail of their code that is wrong and trying to fix that when they should be paying attention to the messages and fixing the overall architecture problems.

 

Very frustrating when people don't read and listen.

0 Kudos
Message 17 of 17
(646 Views)