MATLAB: 3D Matrix extraction and manipulation

3d matrixmatrix manipulation

Hi Matlab experts,
I have a 3D matrix with size (128x64x1140) corresponding to 128 value of longitude, 64 value of latitude and 1140 value of time. I want to extract a matrix of size (67x64x1140).

Best Answer

That can be straightforward or slightly complicated, depending on how you want to do it.
To extract the first 67 rows:
M = rand(128, 64, 1140); % Create Matrix (To Test Code)
Out = M(1:67,:,:);
To interpolate across the rows:
D1 = linspace(1, 128, 67);
Out = interp1((1:128), M, D1);
Both will produce the matrix you requested, however they are not the same.
.
Related Question