10-26-2009 05:24 AM
Hello everyone,
perhaps I overlook the obvious but I can't find a solution for combining two 1D arrays in one 2D array AND (that's the impossible part for me) using the arrays as columns instead of rows.
Example:
Array 1: 1, 2, 3, 4
Array 2: 5, 6, 7, 8
Result: 1, 5
2, 6
3, 7
4, 8
The "build array" function seems to add all arrays as rows... I suppose I could transpose the array, but I want it to run in a sub-VI in different loop constructs and I feel a bit uncomfortable with that - I guess a would end up with a totally mixed array. Perhaps I was just to blind to find the right function?
Cheers, Jessi
Solved! Go to Solution.
10-26-2009 05:30 AM
10-26-2009 05:42 AM
There is a saying " When something looks very simple, then May be you've misunderstood the point completely". I dont know if that is the case with me at the moment. But as far as ive understood your question. you need to ad up two 1-D arrays into one 2-D array. Moreover u need to add em up as a column. So for the first part u need to wire both ur arrays to the Build array block to get your 2-D array.
As far as adding them up in columns is concerned, u can do that by taking the transpose. and that should solve the problem. Provided if ive understood the problem the way ur encountering it.
Lastly the part about using the array as a Sub VI is concerned. May be i'll help if u state it a bit more objectively what is that you want to do. Cuz i dint get that part.
Have a ncie Day.
10-26-2009 06:06 AM
Thanks a lot. Seems like I have to transpose it, so I will just find a work-around for problems it may cause.
Concerning the sub-VI: I wanted to use the combined array in a loop-construct where other columns might be added - which would lead to the transposition of a transposed array and finally to lots of chaos 😉 I haven't programmed it yet, so it's still a bit whishy-washy... I will simply construct the final array after everthing else is finished, so I'm on the save side. I just wanted to see if there is a simple transpose-free solution.