05-05-2016 04:28 PM - edited 05-05-2016 04:29 PM
Hi everyone,
I want to plot the last 5 plots on the same XY graph with differents colors. For this I am using a shift register. Using shift registers makes the plot colors change.
ex:
Imagine I choose plot 1 to be red, plot 2 orange and plot 3 yellow ( XY graph properties )
when I start the VI this is what happpens
First iteration plot: red
----------
Second iteration plot: red
first iteration plot: orange
----------
third iteration plot :red
Second iteration plot: orange
first iteration plot: yellow
The shift register makes the plot shift to the bottom making the new plot always in red.
what if I want the plot to keep the same color even if they are shifded? ( first iteration plot always in red and the second in orange ... )
Thanks in advance,
F
Solved! Go to Solution.
05-05-2016 06:01 PM - edited 05-05-2016 06:02 PM
Use Replace Array Subset to replace a plot. Use the i and Quotient & Remainder to determine which plot to replace. This eliminates the need for shifting.
05-05-2016 06:10 PM
Attach your VI so we can see how you are building things into the shift register..
My guess is that you are using build array and putting the new plots at the beginning of the array rather than the end.
05-13-2016 08:45 AM
Hello,
Here is an exemple of the VI I have right now.
Regards,
F
05-13-2016 09:02 AM - edited 05-13-2016 09:02 AM
You made that much more complicated than it needed to be the way you were using multiple shift registers with history. It was bascially like I was thinking where you wree building the arrays backwards.
Just use Build Array on the graph data and a single shift register. See attached.
Also, when you run a while loop N number of times, you should be using a For Loop
(PS. It helps to put data into the controls as default so that all we have to do is click the run button and see stuff happen. Your empty array meant nothing happened when I first tried your VI.)
05-13-2016 09:12 AM - edited 05-13-2016 09:13 AM
Oh that is nice..
Thanks very much.. ...How can I fix the plot number to 5 please?
Regards,
F
05-13-2016 09:14 AM
I don't understand what you are asking for.
05-13-2016 09:32 AM
I only want to plot the last 5 graphs..
For exemple: if I generate a 6th plot, it will overwrite the first
If I generate a 7th plot, it will overwrite the second ......
The main thing is to have 5 plots max! Thanks in advance.
F
05-13-2016 09:44 AM - edited 05-13-2016 09:45 AM
Then initialize an array of 5 plots. Use Replace Array Subset to replace each plot in order.
05-13-2016 10:13 AM
Thanks, this is what I need :
F