www.gusucode.com > images 案例代码 matlab源码程序 > images/ReadMultipleImagesFromASingleGraphicsFileExample.m

    %% Read Multiple Images from a Single Graphics File
% This example shows how to read multiple images from a single graphics
% file. Some graphics file formats allow you to store multiple images. You
% can read these images using format-specific parameters with |imread|. By
% default, |imread| imports only the first image in the file.
%%
% Preallocate a 4-D array to hold the images to be read from a file.

% Copyright 2015 The MathWorks, Inc.

mri = zeros([128 128 1 27],'uint8'); 
%%
% Read the images from the file, using a loop to read each image
% sequentially.
for frame=1:27
    [mri(:,:,:,frame),map] = imread('mri.tif',frame);
end
whos