LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i plot data from 2d array one at the time on the same waveform graph

Solved!
Go to solution

i can see in your example that the value ranges from 1.4 to 2.6 and that the chart plots a value at each iteration. but i would like to see only one output bar which intensity depends on the value at the current iteration.

0 Kudos
Message 11 of 23
(2,393 Views)

If you only want to see a single bar, use only the tank indicators. Using a graph or chart makes no sense.

 

(Note: You can also right-click the tanks a "show digital display" eliminating the extra indicators)

 

If you want to chart one value and show the other as a bar at the current time, you could do something like in the attached.

 

It is really not clear what you actually want.

0 Kudos
Message 12 of 23
(2,390 Views)

i need the same behavior on the tank to appear on the graph. so every 0.5s second two plots(plot and plot1) be visible with the same position(0,1). so each iteration of the loop, only the height and the color of bar lines  changes according to the values.

i have attached a picture of this.

thanks for having a look.

 

Yannstephen.

0 Kudos
Message 13 of 23
(2,375 Views)
Solution
Accepted by yannstephen
0 Kudos
Message 14 of 23
(2,365 Views)

Tanks you Sir for this answer.its exactely what i was looking for. only problem is that i dont get some of the stuff u added.can you please add some comment on how your block diagram.it would help a lot.anyway thanks again for ur help.i can continue now with my project.

 

Yannstephen Smiley Happy

0 Kudos
Message 15 of 23
(2,352 Views)

It's all simple array operations. you can right-click any of them and call up the help.

 

If you want to graph two plots with two points, you need to have a 2x2 array. Initialize it with NaN so the points don't plot. Since position 0 should only show plot 1 and position 2 only data for plot two, we only replace element(0,0) and element(1,1) with the two values.

 

Feel free to ask more specific questions if something is still not clear.

0 Kudos
Message 16 of 23
(2,349 Views)

Sorry sir but i am not quite getting the operation going at the inner for loop.Mostly the Replace array subset.i understand that each 1s in ur outer loop, ur inner loop runs twice quickly storing both value read from the 1D array containing two data for each plot and store the first valu(first plot) at position 0,0 since i = 0 and position 1,1 for value two(plot1) at second iteration since i = 1. this 2x2 array now get sent to the graph.is the shifht register use to empty out the 2x2 array after it as been sent to the graph so it ready for the next ieration of the outer for loop?

0 Kudos
Message 17 of 23
(2,342 Views)

@yannstephen wrote:

Sorry sir but i am not quite getting the operation going at the inner for loop.Mostly the Replace array subset.i understand that each 1s in ur outer loop, ur inner loop runs twice quickly storing both value read from the 1D array containing two data for each plot and store the first valu(first plot) at position 0,0 since i = 0 and position 1,1 for value two(plot1) at second iteration since i = 1. this 2x2 array now get sent to the graph.is the shifht register use to empty out the 2x2 array after it as been sent to the graph so it ready for the next ieration of the outer for loop?


With each iteration of the outer loop, we start with a 2x2 2D array containing all NaN and we want to create an output that is:

 

Value1 NaN

NaN Value2

 

Thus we edit the array twice. You could unroll the loop and just add two "replace array subset" operations in a row, or you could just use a  FOR loop to avoid code duplication as I did here. The shift register is initilized with a blank 2D array every time the loop runs. It is needed to retain the modification of the first iteration so we end up with both modifications after two iterations. This is a very basic shift register use, so I don't understand where you have problems understanding. The loop runs twice, because we index over a 1D array of size=2. 

 

As with anything in life, you could achieve the same in many other ways. Mine is relatively efficient, because it operates in-place.

 

To better understand what is going on, use execution highlighting and watch the code while it runs.

0 Kudos
Message 18 of 23
(2,335 Views)

Thank u Sir i get it now. but just one last question. if i want more than two input signal. let say n input.Should i initialised the 2x2 array with n rows and n colums so i have nxn array.

0 Kudos
Message 19 of 23
(2,321 Views)

@yannstephen wrote:

Thank u Sir i get it now. but just one last question. if i want more than two input signal. let say n input.Should i initialised the 2x2 array with n rows and n colums so i have nxn array.


Why don't you make a small program and just try it? 😄

 

(Would have been faster than to compose this question! Of course you cannot initialize a 2x2 array with a NxN size, it's a 2D array of size NxN)

0 Kudos
Message 20 of 23
(2,299 Views)