LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update latest waveform of waveform array in graph

Hi all,

 

I am using LV2014.

 

I have an array of waveform. Each time only one waveform of the array is updated (the values of a waveform change or a new waveform is added to the array). If I wire the array to a graph, every waveform will be presented on the graph but I want to plot only the last updated waveform in a graph and keep the graph until a new waveform is updated. 

 

Is there any way to do it? Please suggest me any solution!

 

Micheal

0 Kudos
Message 1 of 13
(3,028 Views)

Hi Micheal,

 

Is there any way to do it? Please suggest me any solution!

Yes, sure there is a way!

Solution:

- keep track which waveform was updated last and only plot that waveform.

- when there where no changes at all then omit the graph plotting…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 13
(2,996 Views)

Thanks GerdW,

 

The problem is that I don't know in advance when and where the latest updated waveform is. It maybe the 1st waveform or 5th waveform or a new waveform is added at the index of 9th.

 


@GerdW

 

Solution:

- keep track which waveform was updated last and only plot that waveform.

- when there where no changes at all then omit the graph plotting…


Could you suggest me some way to track the last waveform?

 

Micheal

0 Kudos
Message 3 of 13
(2,993 Views)

Hi Micheal,

 

Could you suggest me some way to track the last waveform?

- Store the waveform array in some place (notifier, global, functional global).

- Store the index of the last changed waveform in some place (notifier, global, functional global)

- store the timestamp of the last change in some place (notifier, global, functional global)

 

I would go with a functional global: it needs two inputs (waveform and index) and it will output whatever you want to know (once you programmed it)!

 

The generic answer for your generic question is:

1. Develop an algorithm. Draw it on a sheet of paper. Yes, paper and pen.

2. Program that algorithm in LabVIEW.

3. Do you have problems with a specific VI? Then attach that VI!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 13
(2,990 Views)

Dear GerdW,


@GerdW wrote:

 

3. Do you have problems with a specific VI? Then attach that VI!


The attached file is my VI for the problem. In this VI, an array of waveform is created through a FOR loop. In each iteration, another waveform is created and added or summed to a random waveform in the array. 

I want the Waveform Graph 2 presents only the last updated waveform instead of all waveforms in the array.

 

Thank you so much!

 

Micheal

0 Kudos
Message 5 of 13
(2,977 Views)

Hi Micheal,

 

which "attached VI"?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 13
(2,975 Views)

@GerdW

which "attached VI"?


Sorry, I forgot to attach file. I post it again here.

0 Kudos
Message 7 of 13
(2,967 Views)

Hi Micheal,

 

just wire the "last changed" waveform to your graph:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 13
(2,963 Views)

Dear GerdW,


@GerdW

 

just wire the "last changed" waveform to your graph:

 


I have a solution for this problem:
Update Waveform Array.png

Firstly, compare the stored waveform array with the newly updated array to find the index of changed waveform. Then extract the corresponding waveform from the new array to get the last updated waveform.

 

I think, because in my VI, the new waveform is created from an old waveform so we can know what and where the newly updated waveform is in advanced. That makes the problem seem to be trivial.

 

In fact, my "original" problem is a little different. The new data is not created from the old data, so I don't have "thing" to compare to extract the last updated one like this. Please see the attached file for my "original" problem.

 

Thank you so much!

 

Micheal

0 Kudos
Message 9 of 13
(2,954 Views)

Hi Micheal,

 

I have a solution for this problem:

Which is overly complicated!

- Why do you need to search for the changed array element when you already know which one gets replaced/changed in the case structure???

- Why do you need to convert the boolean array to an integer array? You can also search a boolean array for a TRUE constant!!!

 

In your "original" problem you also know which part of your array gets changed: you calculate a (random) position in the left part of your while loop…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 13
(2,952 Views)