gusucode.com > datatypes 工具箱matlab源码程序 > datatypes/+matlab/+internal/+tableUtils/varnameFormats.m

    function vnformat = varnameFormats(format, allowSkips)
%VARNAMEFORMATS Get formats for reading variable names
%   This function is responsible for returning formats for reading variable
%   names. The allowSkips argument controls whether the returned format can
%   contains skips or not.

%   Copyright 2014-2016 The MathWorks, Inc.

fi = matlab.iofun.internal.formatParser(format);

% TabularTextDatastore does not respect skips, readtable does
if ~allowSkips
    vnformat = repmat('%q ', 1, nnz(~fi.IsLiteral));
    return
end

fi.Format(~fi.IsSkipped) = {'%q'};
fi.Format(~fi.IsLiteral & fi.IsSkipped) = {'%*q'};
vnformat = strjoin(fi.Format, ' '); %Concatenate the Formats into one character vector.
end