LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to zero padd array

Solved!
Go to solution

Hi guys

 

I am trying to perform zero padding.I am having 512 by 512 array and I want to add 256 rows of zeros above and below of my array so as my new array will be 1024 by 512,where 1st & last 256 rows are zeros  .I tried to use zeropadd subvi but it can perform on 1d array only.I will appreciate your help

 

Parag  

0 Kudos
Message 1 of 14
(2,989 Views)

Hi parag77,

 

I think Build Array function will do the trick. Select Concantenate Inputs to append 2D arrays.

http://zone.ni.com/reference/en-XX/help/371361K-01/glang/build_array/

 

Ee Lim



See that button on the left side of this post...

If you feel my post is helpful, all you need is just (at most) 2 seconds to click that button, to show your appreciation. Thank you~~



0 Kudos
Message 2 of 14
(2,979 Views)

Hi parag77,

 

Presuming that you are building a 2D array. Have your tried creating that array of zeroes using Initailize array (http://zone.ni.com/reference/en-XX/help/371361J-01/glang/initialize_array/)? You can use that to build an array of zeros. You can merge the top and the bottom and top of the 512 by 512 array by using Build Array (http://zone.ni.com/reference/en-XX/help/371361J-01/glang/build_array/).

 

Give it a try and let me know how it goes.

 

PS: Please do attach a VI of what you have done so far next time

 

Warmest regards,

Lennard.C 

Learning new things everyday...
0 Kudos
Message 3 of 14
(2,975 Views)

Hello parag77

 

Have you tried using the "Initialize Array" node and the "Build Array" node together ????

 

See attached image.

 

Note the build array has to be set to concatenate

Derick Mathew
0 Kudos
Message 4 of 14
(2,974 Views)

Derick Mathew

Thank you for your suggestion

 

I tried to used the same as you post but the appended or build matrix is 3d not 2d .

 

Thank you 

Parag

0 Kudos
Message 5 of 14
(2,960 Views)

You can expand the Initialize Array as Per your Requirements 🙂

Derick Mathew
0 Kudos
Message 6 of 14
(2,949 Views)

Hi parag77, 

 

How about you use initialize array to build the 1024 by 512 array of zeroes and then replace the middle with your 512 by 512 array using Replace Array Subset (http://zone.ni.com/reference/en-XX/help/371361H-01/glang/replace_array_subset/)? Or you could to build 512 by 512 array of zeroes and put your desired array in between using Insert into Array (http://zone.ni.com/reference/en-XX/help/371361J-01/glang/insert_into_array/).

 

Warmest regards,

Lennard.C

 

 

Learning new things everyday...
Message 7 of 14
(2,947 Views)

Did you modify the build Array node to concatenate inputs ???? that should help

Derick Mathew
0 Kudos
Message 8 of 14
(2,935 Views)

Thank you Lennard

 

PFA my VI .I tried to do as per link send by you but when I concatenating the array the new array formed is 3d but I want 2d for filteration .

 

Thank you 

Parag

0 Kudos
Message 9 of 14
(2,934 Views)

check image to see what i mean

Derick Mathew
0 Kudos
Message 10 of 14
(2,930 Views)