LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add zeroes to an array

Hi,

I need to have an output array in the size of 1000.

I have a 2D input array with a certain row size (say 400 elements). I
would like to add "0" till i recive a 2D array with a row size of 1000.

What the procedure of doing that?

Thanks!

0 Kudos
Message 1 of 5
(2,917 Views)

You could create your 1000 x 1000 zero array then replace the first 400 x 400 elements like this

David

Message Edited by David Crawford on 10-07-2006 05:26 PM

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

Padding (and truncation) is easiest done with "reshape array" (check the online help).

For a 2D array, just do it in a loop. 🙂 (I assume that you want to keep the column size constant).

Message Edited by altenbach on 10-07-2006 11:07 AM

Message 3 of 5
(2,902 Views)
Thanks Dave, Appriciate the fast response!, however Just for the
simplicity of things I would like to rephrase my request:

lets say that i have the following input 1D array: [1, 2, 3, 4]

I need to have an output array in the size of: 10, so i wish to take
the input array and add "0" to the rest of the 6 places. The result i
wish to have will be: [1, 2, 3, 4, 0, 0, 0, 0, 0, 0]

I will do the extrapulation to a 2D array with a 1000 size of the
output array

Thanks again

Amir

0 Kudos
Message 4 of 5
(2,882 Views)

Just follow Christian's has suggestion and use Reshape array.

David

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