LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read data from file to chart

Hello everybody,

 

I have one chart where, among other inputs, the speed of a car is shown. I am trying to plot on the same graph two speeds: the car speed and another whose values are written in an excel file. The idea is that the signal from the file shows the target speed so the driver in the car can adjust the speed.

 

How is it posible to read data from a file and show it in a chart?

 

Thank you very much in advance!

0 Kudos
Message 1 of 11
(4,510 Views)
0 Kudos
Message 2 of 11
(4,507 Views)

Hello Artem,

 

thank you for you link. I have been looking on the internet and trying by myself for long, and I still don't get how can I start. I would be very thankfull if you can give me a little help, a guideline, because I have been looking for it and somehow I never find something that can help me in what I want to do.

 

 

0 Kudos
Message 3 of 11
(4,458 Views)

hi loewesh,

export your excel file as CSV (text file), there are other options, but that should be the easiest.

then read with "Read Delimited Spreadsheet.vi".

put your data either into a chart or a graph.

example-read-from-spreadsheet.png

you can save the image below and drag+drop it onto a block diagram.

 

for ways to get data into charts/graphs have a look at the examples coming with labview,

search for "Waveform Chart Data Types and Update Modes.vi" or "XY Graph Data Types.vi".

 

hope that helps


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 4 of 11
(4,454 Views)

Tank you very much!

0 Kudos
Message 5 of 11
(4,452 Views)

With this diagram all the data is read at once, but I am trying to read the data second by second. This is, in the same diagram, two data: the data saved on the file and the data of the input which value is read every time the while loop is actualized.

Any idea?

 

Tank you very much.

0 Kudos
Message 6 of 11
(4,429 Views)

Is the "input data" only a single sample for each loop iteration or many?

 

If only 1 sample, then go ahead and read the entire file as shown above and then use an Autoindexing Tunnel input on the loop.  Then you already have the sample you want ready to go to the chart.

 

If multiple samples, then you are probably going to want to store the index of the array in a shift register and then Array Subset to get the data you need to write to the chart.  Again, just read the entire file beforehand.


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 7 of 11
(4,419 Views)

I one of my programs I have made it to save the graph data in a temporary file so if the program is stopped and restarted you can restore the graphs if desired. If restore is selected the program then reads the temporary file into the graph.

 

One important part is you need to store your temporary graph data in a simple tab delimited text file so you can use the Read and Write delimited Spreadsheet vi's.

 

Here is what the restore portion looks like for one of my graphs.

LGCapture.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 8 of 11
(4,404 Views)

Thank you everybody, but I think I didn't explain myself good enough. I'll try to do it more

 

I have to make a measurement of the speed of a car in a testbench. The driver on the car has to adjust the speed according to the driving cycle, which is like this:

 grafik.png

My idea was to plot both, the driving cycle and the measurement of the speed of the car, in the same chart, so the driver can follow the speed given by the cycle. I thought there might be a way to plot on the chart the cycle (I have the points in an excel file). As well, I'd have to plot the cycle before the actual measure, so the driver can see what is coming.

 

 

0 Kudos
Message 9 of 11
(4,356 Views)

If you can use Waveform/XY Graph (not chart), you can use some "decorations"

see here

0 Kudos
Message 10 of 11
(4,351 Views)