No products are associated with this question.
image3D = cat(3, slice1, slice2, slice3, slice4, slice5);
You could put it into a loop
for slice = 1 : totalNumberOfSlices thisSlice = GetSlice(); % Whatever you have to do to get one 2D image. if slice == 1 image3D = thisSlice; else image3D = cat(3, image3D, thisSlice); end end
The problem is not constructing the 3D array: the problem is displaying it. MATLAB does not have good voxel visualization routines. You could try http://www.mathworks.com/matlabcentral/fileexchange/3280-voxel