www.gusucode.com > datastoreio工具箱 matlab源码程序 > datastoreio/+matlab/+io/+datastore/+internal/+validators/validatePaths.m

    function pths = validatePaths(pths)
%VALIDATEPATHS Validates the input paths.

%   Copyright 2015-2016 The MathWorks, Inc.

    % imports
    import matlab.io.internal.validators.isString;
    import matlab.io.internal.validators.isCellOfStrings;

    % empty cell array {} is a valid input
    if iscell(pths) && isempty(pths)
        return;
    end

    % inputs must be strings or cell array of strings (vector)
    if ~isString(pths) && ~isCellOfStrings(pths)
        error(message('MATLAB:datastoreio:pathlookup:invalidStrOrCellStr', ...
                                                                 'Files'));
    end
    
    % make inputs cell arrays of strings, cellstr works on chars, cellstrs.
    pths = cellstr(pths);
    
    % inputs cannot contains empty elements
    if (any(cellfun('isempty', pths)))
        error(message('MATLAB:datastoreio:pathlookup:cellWithEmptyStr', ...
                                                                 'Files'));
    end
end