04-03-2018 10:07 PM
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
04-04-2018 01:14 AM
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…
04-04-2018 01:27 AM
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
04-04-2018 01:44 AM - edited 04-04-2018 01:45 AM
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!
04-04-2018 09:09 AM
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
04-04-2018 09:13 AM
04-04-2018 07:51 PM
@GerdWwhich "attached VI"?
Sorry, I forgot to attach file. I post it again here.
04-05-2018 01:28 AM
04-05-2018 06:31 AM
Dear GerdW,
@GerdW
just wire the "last changed" waveform to your graph:
I have a solution for this problem:
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
04-05-2018 06:53 AM
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…