Get to selected 2d matrix from a 3d matrix
Show older comments
Ok so here's the question. I'm struggling to extract selected 2d arrays from a 3d array. Say an image with 15 frames and 3 slices and resolution 128X80 which gives a matrix size of (128,80,45). The querry is how do you extract say the first slice of every frame which are (128,80,1) & (128,80,4) & (128,80,7) ....till....(128,80,43). Which will give a size (128,80,15).
Outline of wrong code
nslices=3; % number of slices nframes=15 %number of time frames slice_num=1; % slice wanted
dir = pwd; dir = [dir, '\'];
[filename1,dir] = uigetfile('*.7','Pick first file'); [FID,headers]=read_MR_rawdata(filename1); data_all=squeeze(FID);
im_data=zeros(size(data_all,1),size(data_all,2),nframes);
count=1 for x=slice_num:nslices:nframes*nslices im_data(:,:,x)=data(:,:,x); count=count+1 end
Thank you so much
Accepted Answer
More Answers (0)
Categories
Find more on Graph and Network Algorithms 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!