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

    %% Create ImageDatastore Object 
% Create an |ImageDatastore| object associated with all |.tif| files in the MATLAB(R) path and
% its subfolders.  Use the folder names as label names.

%%  
imds = imageDatastore(fullfile(matlabroot,'toolbox','matlab'),...
'IncludeSubfolders',true,'FileExtensions','.tif','LabelSource','foldernames')