I am trying to remove blank (=0) cols and rows from 2D images in 3D stack of images and then generate a new 3D stack:
for i=1:numVols;
for j=1:numFrames; % Crop black boundaries
tempvol = VolStack(:,:,j,i);
tempvol(:,all(tempvol==0,1))=[];
tempvol(all(tempvol==0,2),:)=[];
VolStackTemp(:,:,j,i) = tempvol;
end
end
The strange thing is that it works sometimes but most of the time I get an error due to the line:
VolStackTemp(:,:,j,i) = tempvol;
Subscripted assignment dimension mismatch
Any ideas why?
tepvolhas a different size in each iteration. A matrix has always the same size in each slice. - DanielVolStackTempa cell matrix - Dan