MATLAB: Images to stacks

Image Processing Toolboximagejimagesstacks

Hey there!
I am totally new to mathlab, but I think what I want to do is quiet easy, so I hope someone can help me.
I have sequences of tiff images, which I want to combine into tiff stacks. The file names are numbered, so for stack one it is "name"001001 until "name"001120 and then …002001 until …002120 for stack two and so forth.
Right now I am importing them manually into ImageJ and make stacks and save them, but after a few 100 stacks, I am nearly getting crazy..
I searched the file exchange and also all kinds of ImageJ plugins but I am lost.
Can someone help?
Thanks for your support! Anke

Best Answer

I = zeros(nRows,nCols,nTifImages,'uint8'); %preallocate block
for ii = 1:nTiffImages %loop over image
I(:,:,ii) = imread(sprintf('name%s.tif',num2str(ii+1000,'%06i'))); Set each image to slice
end
Welcome to MATLAB and Answers!