01-16-2023 04:28 AM
Hi, I want to get the average value of the mutiple plots of in my waveform graph.
So I get this kind of graph, and all I want to do is get the average value of all three plots.
I also include my code.
Thanks
Yoo
Solved! Go to Solution.
01-16-2023 10:25 AM
Sorry, I really don't understand what you are trying to do with your code. [I must confess I've never really fully mastered the Feedback Node -- are you trying to build simultaneous plots of one graph (Waveform Graph), and "accumulations" of 1, 2, and 3 graphs in Waveform Graph 2, 3, and 4? and what's with Waveform Graph 5?].
Graphs, as I'm sure you know, are "Plot All At Once". If you have One Channel of data (say 1000 points), you plot 1 Channel with however many data points have "values" (you can suppress plotting by making the values NaN). If you want to plot N channels, you need a N x 1000 Array (and if you want the plots to have separate Y origins, you need to add appropriate offsets to the data you are plotting).
Let's say you are sampling 3 Channels simultaneously, and expect to get out 3 x 1000 points. You want to plot Ch 1, Ch 2, and Ch 3 (each offset by, say, 100, such that Ch 1 is "on top", and (on a separate plot) plot the average of Ch 1 to 3. The second plot is easiest -- simply average the three arrays (add them and divide by 3) and plot it. To plot the three individual channels, make a 3 x 1000 array by Build Array with Ch 1, Ch 2 - 100, and Ch 3 - 200 as the entries, and plot this 2D array.
I am deliberately not attaching a VI. I hope I explained what (I think) you need to do, and trust that you know enough LabVIEW to know how to do it in LabVIEW.
Bob Schor
01-16-2023 11:49 AM
As a first stop have again a look at my comments to your earlier question.
It is wrong to think that adding more and more crazy code will somehow make things work better.
What you currently have is a jungle nightmare that I (and most others) are not willing to untangle. It simply makes no sense!
Create a clean state machine, simplify! Correct code would fit on a postcard!
01-18-2023 09:35 PM
I apologize for my abstruse code.
The sequence is essential for my situation(it's a physics experiment and it's hard to explain all the details here), I also agree that the sequence needs some handling.
The feedback nodes are for stacking(or accumulating) the previous plots in one plot. It works fine, and again, I agree it is not a usual way for it.
For me, I'm trying out if things actually "work" I tend to handle the codes to be more smarter or neat.
Thank you for your advice
Yoo
01-19-2023 11:31 AM
@hobbes8000 wrote:
The sequence is essential for my situation(it's a physics experiment and it's hard to explain all the details here), I also agree that the sequence needs some handling.
Here is basically equivalent code to your three long parallel trains of sequences. (It really does not matter if it is physics, chemistry, aeronautics or philosophy 😄 )
(MUCH simpler code! better synchronicity between the three IOs, etc. Make sure to add error handling back.)
Your ovetrall architecture, especially the code with the scattered feedback nodes really (really!!) makes no sense.