MATLAB: How to analyze hypercube data

hypercpectral imaginghypercube data

I have a hypercube data with size 512 x 320 x 211. I want to divide this cube into smaller cube data size 32x32x211 and I want to get the mean value of all smaller cube data. How can I do that using Matlab? Thanks a lot.

Best Answer

You want to divide the data into smaller pieces without any overlaps? So 512 x 320 x 211 array will be divided into 160 of 32x32x211 arrays and you want mean values from each of them, correct?
You can do it in various ways, but if you have Image Processing Toolbox, blockproc function can be useful.
myfun = @(block_struct) mean(block_struct.data(:));
I2 = blockproc(I,[32 32],myfun);
where I is your hypercube data with size 512 x 320 x 211 then I2 will be 16x10 array with mean values of each divisions.