07-20-2020 08:04 AM
Hello all. I am trying to make a subVI that will convert a numerical 1d array into a 2d array. I want the VI to be able to accept different dimensions for the 2d array and be able to adjust accordingly. I tried to use the Reshape Array function, but I get an error if the input and output arrays do not have the same dimensions.
I have also used nested For Loops, which seem more successful, except I can't get the columns to update correctly. I know the reason for this is because I don't know how to increment the inner loop and insert it into the array. I'm not sure if I should use a local variable for the 2d array and put it inside the inner loop.
I have both versions (Reshape Array and nested For Loops) in this program. I will use whichever works and get rid of the other one.
I'm trying not to use Build Array since I read that Build Array makes a copy of the array each time it runs. I may be doing the same thing with what I am doing, but I don't know.
Solved! Go to Solution.
07-20-2020 08:09 AM - edited 07-20-2020 08:12 AM
Hi Dhouston,
@Dhouston wrote:
Hello all. I am trying to make a subVI that will convert a numerical 1d array into a 2d array. I want the VI to be able to accept different dimensions for the 2d array and be able to adjust accordingly. I tried to use the Reshape Array function, but I get an error if the input and output arrays do not have the same dimensions.
Because your output array is labelled "2D array", but it is a 3D array - which is shown in the context help when you move the mouse over the broken wire!
Why are those #rows and #columns control set to I8 representation? After correcting the error(s) your VI should look like this:
07-20-2020 08:56 AM
Yep, that solves the problem. Thanks!