LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Plot Chart in a Desired Speed

Solved!
Go to solution

Dear Community,

 

I am currently trying to simulate a pre-recorded signal in LabVIEW. I have successfully plotted the amplitude vs. data points on a chart from the excel file. However, I am having trouble plotting in the speed I want to mimic in real-time. My goal is to plot 1000 data points per second from the excel sheet, however, I'm not sure how to adjust the timing loop to achieve that fast. Also, when I rerun the program, how do I make the x-axis of the chart start from zero again. Thank you in advance!

 

The files are attached below.

"Read_Signal3.vi" is basically reading data from "20.csv" and plotting the points in a chart.

"20.csv" are the data points recorded with the first column as time and the second column as amplitude to the plot.

0 Kudos
Message 1 of 4
(1,491 Views)
Solution
Accepted by topic author jackhsu66
  • What a mess!
  • To run at 1000Hz, your wait should be 1ms, not 10ms. (but software timing might not be super deterministic)
  • You can remove the header and get the second column as numeric 1D array before the loop, then just autoindex.
  • You can write an empty array to the chart history property mode to clear the chart.
  • You can show the digital display of the chart, no need for an extra indicator.
  • There is no need to get a subset of higher columns (that don't exist!) later in the run.
  • The first valid row is 1. (Taking the subset starting with 2 drops your first data value. The first array index is zero)
  • Your file is not an excel file, just a delimited text file.

 

See if the attached can give you some ideas.

Message 2 of 4
(1,474 Views)

Thank you so much for the constructive feedback, very appreciate your time!

My code indeed looked ugly... I really need to spend more time understanding the basics of dealing with arrays.

0 Kudos
Message 3 of 4
(1,395 Views)

A small addition to Altenbachs #1, Windows is very bad at keeping timing at sub 3ms periods. If you want to replay in a realistic manner it's probably better to plot 10 points at once in a 10ms loop.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 4 of 4
(1,370 Views)