LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

plot time and 2D array

Hello everyone, 

 

I'm using VISA read to read the data from an arduino. I'm reading an 2D array containing data from five pressure sensors (represents the rows in the array). I want to display the data visually from the five sensors. So far I get all the values from the five pressure sensors in the y axis and the sensors as x axis (sensor 1, sensor 2,..., sensor 5). How can I plot the time as the x axis instead? I attached a picture of the block diagram, hope it is enough.

 

Appreciate help!

0 Kudos
Message 1 of 7
(3,302 Views)

Sorry, meant to write that the five pressure sensors represent the columns and not the rows.

0 Kudos
Message 2 of 7
(3,289 Views)

Hi number,

 

are you kidding to attach a ~9MB JPG image where a ~100kB PNG screenshot would do nicely?

Why don't you attach your VI instead? How should we debug your image with LabVIEW?

 

Hint: use "Elapsed Time" to build your x axis. Use an XY graph instead of a simple waveform graph…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 7
(3,276 Views)

@50616d656c61 wrote:

 I attached a picture of the block diagram, hope it is enough.


Well, no, it is not very helpful.  We cannot see the entire VI (including, in particular, the indicator to which you are sending the data, unless I overlooked it), we cannot test the VI, modify it, etc., and we also do not have a LabVIEW-readable example of the data you are trying to plot!

 

Nevertheless, I'm going to make some guesses and see if I can help.  I'm guessing you are writing to a Waveform Chart.  I am guessing you know the delta-time between VISA samples (and have a reasonable expectation that this time remains constant, let's say it is 0.1 sec, for each data point).

 

If you plot 100 rows (representing 100 samples from the 5 sensors), you should get 5 lines with the X (Time) axis going from 0 to 99.  Right-click your Chart and choose Properties.  Look at the Scales property of the X Axis.  Now it gets a little tricky, depending on whether you are plotting 1D Array of Waveforms or 2D Array of Dbls (see, looking at your VI, I would know this ...).  Let's say 2D Array of Dbls.  The X Range  may be AutoScaled -- you want to control this, so you want AutoScale to be off.  Look at Min and Max -- this sets the left and right extremes.  Now there are three quantities to consider -- the number of discrete points on the chart (should be at most 1000, let's choose 600 just for this example), the sampling time (here 0.1 sec), and the "time width" of the Chart (here 600 * 0.1 sec = 60 sec).  So make the following adjustments:

   X Min = 0, X Max = 60 (to set the width, in seconds)

   Multiplier = 0.1 (to scale the samples to Chart units)

Look at the Chart.  Its limits should be 0 and 60 (which is what you want), and as you plot, your data should take 60 seconds to "crawl" from the right edge to the left (assuming you are using a scrolling Chart).

 

Bob Schor

0 Kudos
Message 4 of 7
(3,271 Views)

Hi GerdW, 

 

I'm sorry, didn't know it could be that upsetting to upload just an image. The reason I did that was because there is no internet connection on the computer I'm working on. So thought maybe it was easier to describe it and compare it to an array with 5 columns that I want to view in a plot with the time as x-axis.

 

But I can try and see if I can find a USB stick somewhere and reduce my program to only that part that I need help with and then get back to you. 

 

Sorry again, my mistake. Not easy to be new in a forum.

0 Kudos
Message 5 of 7
(3,267 Views)

Hi again, 

 

now the program is attached. 

0 Kudos
Message 6 of 7
(3,258 Views)

Hi number,

 

see this:

check.png

I just changed the chart history to 100 samples length and the x scale multiplier to 0.01!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(3,255 Views)