LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

separate 2d array into smaller 2d arrays??

i have an array extracted from an image. i need to separate it into smaller size arrays of size 16*16 (or any size n*n) and find their means and variance. could u please help me
0 Kudos
Message 1 of 7
(3,634 Views)

Hi aperf,

      There are many Array tools, among them "Reshape Array".  Assuming you haven't found it already, it will easily slice your 1D array into an n*n (2D) array.  Note the Transpose and Decimate functions as well. 

Cheers.
When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 2 of 7
(3,621 Views)
thanks a lot , but how can i transform 2d array into 1d array ?? sorry for keep asking u, i'm new to this program.
0 Kudos
Message 3 of 7
(3,618 Views)
Hi aperf,
      Here's a simple VI that shows how to use "Reshape Array".  When you see the "Magic number" 16, that's because you mentioned 16 in your post!
 
Cheers.
 
When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 4 of 7
(3,613 Views)

Hi again aperf,

      On re-reading your post, I wonder if you really want to reshape a 2D array into a 3D array (again using Reshape Array.)

I don't understand how your data is organized.  If you want to examine "squares" cut out of a 2D plane, perhaps its the "Array Subset" tool you need.  Array Subset will work with arrays of any dimension.

Cheers.

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 5 of 7
(3,609 Views)

"Reshape" is probably not the right tool here, since you probably want an arbitrary subset.

Use "array subset" anchored at the desired 2D index to get a 16x16 subarray (for example).

Now you still need to reshape it to a 1D array because the "Mean|standard_deviation|variance" tool from the statistics palete only accepts 1D arrays.

See image. Your big 2D array enters from the left.

You should be able to e.g. incorporate this inside two FOR loops to  generate all possible 16x16 subarrays.

Message Edited by altenbach on 08-13-2005 09:39 PM

0 Kudos
Message 6 of 7
(3,610 Views)
thank you you 2 guys. i'm trying to work with for loop now, hope i can do that!! (or i might need some help again)
0 Kudos
Message 7 of 7
(3,588 Views)