08-10-2025 09:01 AM
Hello,
I have uploaded a program where I want to display 3 sets of array of size 4, so totally 12. And I want it to be a continously running plot where the plot adds on from the previous loop, but currently the plot is displaying only the current loop and not the previous loop. Why is that? Let me remind you, I cannot use a shift register because this is an example for another program which I am trying to do and in that program this plotting is a small subVI where the program goes out of the subVI, does a lot of stuff and in the next loop comes back. You can say then add shift register in the bigger loop, but that is also not possible, because that loop part was designed by someone else and its a mess with a stacked sequence inside and having many frames, so adding a shift register wont do. So I am trying to solve it in this small problem using a local variable. This is the main issue. And also as I said i am trying to plot 3 sets of data, and when I combine them together, it turns into a 3d data, so that is why you can see i do stuff like reshape array and index array in between. If you can help me correct that to a better way would also be nice.
Thank you
Solved! Go to Solution.
08-10-2025 09:50 AM - edited 08-10-2025 09:58 AM
08-10-2025 09:56 AM
Yu have not explained how you want to add the 12 data points. A graph with three traces growing by 4 points each? A singe graph growing by 12 points per iteration?
08-10-2025 10:34 AM - edited 08-13-2025 07:23 AM
08-10-2025 11:21 AM
@Knight of NI. I did everything you just shown. One of my problems was a 3d array instead of 2d array. So instead of using build array to combine those 3 arrays, I used insert into array at indexes 0,1 and 2. So that gave me a 2d array. But then when I try to plot it in graph by building array with graph history it still was making it 3d array. Thats when I checked your program and saw that there is an option to concatenate inputs in build array, i did that and i got the result like yours. But there is still a problem with your program. That is I am not seeing all 12 values, we can only see 3 values. I made a small change to show you that.
This is not what i want. All 12 values are seperate. I can explain more in detail. I have 4 batteries and 3 values from those 4 batteries are coming that is msg counter, error 1 counter and error 2 counter. So each battery has these 3 values and I want to plot all the 3 values of each battery and total 4 batteries together. So in total it will be 12 values. And the number 4 can change, it can be 3 batteries or 2 or 1 or 5. But as a standard for us its 4 batteries and I need to see all 12 values.
08-10-2025 12:28 PM
You get three traces with four new values each per iteration (total=12). If you want to add a row with 12 values, reshape the 2D array to a 1D array before appending.
08-11-2025 01:25 PM
you can create a sub-vi with loop with shift register. It will work as a "buffer.
write ain iteration - with the iteration number of the main loop that is calling the subvi.
The iteration = 0 will innitialize the buffer creating a 2D array with all the N postions wiht a copy of the 1D 12 position Array.
Then at every iteration, the vi will replace the buffer element iwth the newest data .
This way the vi will not run out of memory and will stay within the size of the buffer size.