01-25-2013 05:09 PM
How can I create a 2D array that is updated and displayed on the front panel after each iteration. It is 2D because I have a voltage that corresponds to a load. I want to see the current voltage corresponding to the current load, as well as all previous voltages and loads while the while loop is still iterating
thanks
Solved! Go to Solution.
01-25-2013 05:13 PM
Build it in a shift register.
If you only have two values per point, it might be easier to use a 1D complex array where RE=voltage and IM=load, for example.
01-25-2013 05:14 PM
What have you tried so far? Upload your code, or if it's complicated, then a simple VI showing what you want to do, even if it doesn't work yet.
Are you trying to display this data on a graph, in a table, or in an array indicator?
Do you know the maximum amount of data that you will accumulate?
At a minimum you need a shift register containing the array. You can simply add new points to the array in the shift register, but you can make more efficient if you know in advance how much data you'll need to store.
01-25-2013 05:24 PM
So I made this to give a basic idea of what I want. I want the load along with corresponding voltage to be displayed in a table, and updated after each loop, while also displaying previous values
01-25-2013 05:26 PM
also I will probably only be getting 5 or 6 of each of these values, but there is about a 10min delay between each loop iteration
01-25-2013 05:30 PM
Try this:
01-25-2013 05:32 PM
Let's start with the simple approach: build array. You need to initialize the shift register (wire a value to it from outside the loop) with an empty 2D array. Then you just need to add rows onto it using build array twice - once to build the load and voltage into a 1D array, then a second time to add that row to the 2D array.
There's no need for the local variables.
A more efficient approach would be to preallocate the entire 2D array, but since you only have a few data points with a long lag between them, efficiency isn't important so I'd try the build array approach first.
01-25-2013 05:34 PM
You sir, are the man
01-25-2013 05:44 PM
How did you create the empty 2D array to make it look like it does?
01-25-2013 05:47 PM
How else should it look like? 😮
After the right shift register is hooked up, simply right-click the left shift register and select "create constant".
Other possibilities: