LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting "big" 1D array to 10 dimensional matrix&save to file

Hello
 
I have a ~6000 digit long 1D array that I must convert to 10 dimensional matrix and the save to file.
So I have array of 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21....~6000
and I want
 
1,2,3,4,5,6,7,8,9,10
11,12,13,14,15,16,17,18,19,20
21,.....
 
Reshape array-function could do the trick but it seems that I'd have to insert manually the dimension for every row? And I really don't want to do it 600 times.
And array to matrix-function works only for 2D matrixes etc.
 
So are there any functions/existing VI's that could do that conversion automatically? I know one unix-fortran-program that does that but running it in labview/windows is..well...
 
Thanks in advance
 
 
0 Kudos
Message 1 of 5
(2,513 Views)
You use resphape array.  You have to expand the reshape to show the second index, and then calculate how many rows you need.  This will do the trick:



One issue with this is iff you don't have an even amount of 10, then the extra elements get truncated off.  You can fix this by adding one to the quotient if you wish.


Message Edited by Matthew Kelton on 02-15-2008 05:23 AM
0 Kudos
Message 2 of 5
(2,509 Views)
Thanks for the quick reply, but could you clarify the scetch a bit.
And I must point out that the 6000 numbers in the array was an estimate, not really precise number.
Though I might be able to trim the 1D-array to spesified lenght.
And in this case the number 6000 refers to the input array? (because at least it didn't work with the actual array)
 
The important part of the data is in the middle so it really doesn't matter whether the "un-even" numbers might be left out.
0 Kudos
Message 3 of 5
(2,498 Views)
The initialize array on the left was just to create an array.  Everything else should work regardless of array size (I used a Get Array Size to divide by 10).  If you use what is inside the dashed box and feed your array into it, it should work.




Message Edited by Matthew Kelton on 02-15-2008 06:54 AM
0 Kudos
Message 4 of 5
(2,485 Views)

Ok,now it works. I was little hasty (&eager to start enjoying weekend) when trying to figure out the sketch.

Thanks for the help.

0 Kudos
Message 5 of 5
(2,462 Views)