www.gusucode.com > datastoreio工具箱 matlab源码程序 > datastoreio/+matlab/+io/+datastore/@FileDatastore/readall.m

    function data = readall(fds)
%READALL Read all of the files from the datastore.
%   DATAARR = READALL(FDS) reads all of the files from FDS.
%   DATAARR is a cell array containing the data returned by the read method
%   on reading all the files in the FileDatastore.
%
%   See also fileDatastore, hasdata, read, preview, reset.

%   Copyright 2015 The MathWorks, Inc.

try
    fdsCopy = copy(fds);
    reset(fdsCopy);
    data = cell(numel(fdsCopy.Files), 1);
    ii = 1;
    while hasdata(fdsCopy)
        data{ii} = read(fdsCopy);
        ii = ii + 1;
    end
catch ME
    throw(ME);
end