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: 

Adding for loop into Waveform chart to output portion of data for every 30 seconds until data finishes

Solved!
Go to solution

 Good day,

 

I have so far created a waveform chart but showing all the datas in one go. I'd like to show it some portion of data for every 30 seconds until all data in the spreadsheet is shown. 

 

Detailed: 

In the spreadsheet file, the first column will be use as a 'plot' to show the data. Meaning that from 0-128 will be shown for 30 seconds, then the next data of 0-128 will continue to show for 30 seconds until data finishes. 

My plan is to use for loop, however failed to do so. 

My aim is to show data interval like this https://www.youtube.com/watch?v=kxWUCADgGbA

 

Your kind assist is appreciated.

Download All
0 Kudos
Message 1 of 11
(3,352 Views)

Is each file the 128 data points?  Or will your csv be much larger (iecontaining all of the data you want to plot)?


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 2 of 11
(3,325 Views)

the csv file contains 181 times of the 128 data points. Which means that the waveform chart will loop 181 times of the 128 data points. My aim is to have looping iterations of 128 data points for every 30 seconds, for 181 times. 

 

The attached jpeg is what I got so far, however the data only show the first 128 data points only repetitively. 

0 Kudos
Message 3 of 11
(3,321 Views)

@pingping12 wrote:

the csv file contains 181 times of the 128 data points. Which means that the waveform chart will loop 181 times of the 128 data points. My aim is to have looping iterations of 128 data points for every 30 seconds, for 181 times. 

 

The attached jpeg is what I got so far, however the data only show the first 128 data points only repetitively. 


Please attach the VI, NOT a jpeg image.

 

You have some fundamental problems. Your wire goes BEHIND the for loop (your lack of tunnels), and your Array Subset is floating over the for loop (notice shadows on your JPEG). This is what it should look like if wired properly.

 

for loop.PNG

 

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

This is what I've got so far (EEG3 is my testing block before editing EEG 1&2). My aim is to have my waveform chart ran like this https://www.youtube.com/watch?v=kxWUCADgGbA

0 Kudos
Message 5 of 11
(3,293 Views)

I know this isn't the question you asked, but I'd like to suggest another approach (based, in part, on the YouTube video you attached).

 

What I think you want to accomplish is to have the entire waveform scroll (or "jump") across the screen, similar to seeing successive "snapshots" of your data with some subset of points (say 500) being visible at any one time.  Instead of "jump-scrolling", why not consider plotting the points one at a time (all 128 x 181 of them) in a Waveform Chart of 500 points at some rate (say one point every 10 to 100 msec -- the rate determines the rate at which the plot "scrolls")?  You'll see a plot similar to your YouTube example, except instead of "jumping", it will smoothly scroll.

 

Accomplishing this is very easy.  Create a Waveform Chart.  Open your data file, arrange all of the data in one long array (assumed to be continuously-sampled, i.e. the time difference between all of the points is the same), and feed the array into a For loop via an Indexing Tunnel (the one that turns an Array into individual elements, automatically looping over all of the Array elements).  Put the Chart indicator inside this Array and feed the point into it.  Put a Wait (ms) function inside to slow down the scrolling speed to something that you like.  I presume you know how Waveform Charts work, but you can always right-click the Chart Indicator on the Block Diagram and choose Help to get help.

 

Bob Schor

0 Kudos
Message 6 of 11
(3,288 Views)
Solution
Accepted by topic author pingping12

1. Since you want your chart updated every 300ms, then you need to move the terminal to be inside of the loop.

2. You need to update which row to start from each iteration.  This is some simple math with the i terminal and the number of samples you want to display.

3. The file you gave us only has 128 samples of 14 channels.  So the loop should only iterate once.  You can do some simple math to determine the number of iterations to perform (total number of samples in the file divided by the number of samples to display).


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
Message 7 of 11
(3,244 Views)

Thank you all for the solutions. I have read all of them and try to apply it in my own way of understanding. 

This is what my progress so far. I do have the graph ran in an interval time manner. However only one channels are shown and I do not think that the steps that I have apply to my blocks are correct. I'm currently still actively finding a solution. 

Hope to have a final solution soon

Download All
0 Kudos
Message 8 of 11
(3,208 Views)

I have tried the proposed solution, here's the outcome. However, not all my 14 channels displaying properly (4 of them displayed straight line, which shouldn't happen with the data provided).

 

EDIT: I manage to fix 3 of the disfunction straight line charts. Only one of it still left with straight line chart outcome (the very bottom chart).

Download All
0 Kudos
Message 9 of 11
(3,197 Views)

@pingping12 wrote:

(4 of them displayed straight line, which shouldn't happen with the data provided).


Looks like a scaling issue.  It is like there is something in the history that is messing up the auto-scaling.  I recommend you go in and manually set the max and min of each of the scales.


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 10 of 11
(3,193 Views)