From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot XY Graph from logged data in real time

Solved!
Go to solution

I have logged the xy graph data in .txt format using write to spreadsheet file.vi.

Now what i want is to retrieve the data from the file and plot the data in similar time as i logged the data.

For example, the logged data is of 10 sec so when i read the data from the file then the graph must plot in same time i.e 10 sec.

I've attached the solution which i came to so far but i'm able to plot the data instantaneously.

 

Thanks in advance

Best Regards,
Prince Agarwal,
Certified LabVIEW Developer
0 Kudos
Message 1 of 4
(5,333 Views)
Solution
Accepted by topic author Prince17

It sounds to me as though you want to see your data, consisting of a series of time points (uniformly-spaced?) and the values acquired at each time point, plotted on an "evolving" plot as though it were a strip chart of the data as it was being acquired.  Is this correct?

 

LabVIEW provides both a Chart (for evolving data, plotting the "latest point" each time) and a Graph (for static data, where all of the data present is plotted at once).  If the first paragraph's assumption is correct, you are going to need to get "time" into your program and either

  • plot the Y values one at a time on a Chart, using the X values to time when the plot the next point, or
  • plot a Graph of just the first X-Y values, wait according to the X value, then plot the first two points, wait, plot the first three points, wait, etc.

Do you know how to use the Functions on the Timing Palette to "slow down" your program so that it does the plots a point-at-a-time, using one of the methods suggested above?

 

Bob Schor

Message 2 of 4
(5,305 Views)

Thank you Bob_Schor. I've implemented your idea and i got what i wanted.

Best Regards,
Prince Agarwal,
Certified LabVIEW Developer
0 Kudos
Message 3 of 4
(5,288 Views)

Obviously what you are doing is not scalable.

  • In the VI where you are logging the data, the array of points grows without upper limit.
  • The log file grows without upper limit
  • In the graphing VI, you are reading an evergrowing file, which will take more and more effort, reading basically the same data (plus a little new data) 10x per second.
  • On both sides you are opening and closing the file with every iteration, thus temporarily locking concurrent access from the other VI. You have serious resource contention.
  • The two parts will constanty step on each other's toes fighting for the same file. Most likely you get errors if both sides try to access the file at basically the same time.

Why does the graphing need to go via the file? What's the point? If you really want to do that for whatever reason, you need to use lowlevel file IO on both sides and open the file with correct locking so both sides can access it concurrently (one for write, one for read). Keep writing at the current location to append and keep reading at the last location.

 

What is the reason for your convoluted pumping of data across the file system? It simply does not look like such a good idea to begin with.

 

 

0 Kudos
Message 4 of 4
(5,286 Views)