How can I isolate the (x, y) from a (x, y, z) dataset?

1 view (last 30 days)
Ahmet Taskale
Ahmet Taskale on 14 May 2019
Edited: dpb on 14 May 2019
I have a 3D dataset (100x190x142) and I want to isolate the 100x190 (x, y)
How to do this in matlab?

Answers (1)

dpb
dpb on 14 May 2019
Edited: dpb on 14 May 2019
Well, there are 142 100x190 arrays possible, which one(s) do you want?
Just index...
for i=1:size(XYX,3) % iterate over all planes
XY=XYZ(:,:,i); % get the ith plane
% operate on XY here
...
end
Of course, in general "the MATLAB way" would be to just operate on the ith piane and not actually create the temporary--in most cases it probably won't be needed.
Alternatively, depending upon what is meant by "isolate", you can return any subset of planes as another 3D array similarly---
iNeed=[1:3:size(XYZ,3)]; % some arbitary list of planes
XYZneed=XYZ(:,:,iNeed); % that subarray (also 3D if numel(iNeed)>1)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!