time | Calls | line |
---|
| | 333 | function [numVars, numRows] = countVarInputs(args,StringParamNameNotSupportedErrID)
|
| | 334 | %COUNTVARINPUTS Count the number of data vars from a tabular input arg list
|
| | 335 | import matlab.internal.datatypes.isCharString
|
< 0.001 | 8 | 336 | argCnt = 0;
|
< 0.001 | 8 | 337 | numVars = 0;
|
< 0.001 | 8 | 338 | numRows = 0;
|
< 0.001 | 8 | 339 | while argCnt < length(args)
|
< 0.001 | 8 | 340 | argCnt = argCnt + 1;
|
< 0.001 | 8 | 341 | arg = args{argCnt};
|
0.001 | 8 | 342 | if isCharString(arg) % Matches any character row vector (including ''), not just a parameter name
|
| | 343 | % Put that one back and start processing param name/value pairs
|
< 0.001 | 2 | 344 | argCnt = argCnt - 1; %#ok<NASGU>
|
< 0.001 | 2 | 345 | break
|
< 0.001 | 6 | 346 | elseif isa(arg,'function_handle')
|
| | 347 | throwAsCaller(MException(message('MATLAB:table:FunAsVariable')));
|
< 0.001 | 6 | 348 | else % an array that will become a variable in t
|
< 0.001 | 6 | 349 | numVars = numVars + 1;
|
< 0.001 | 6 | 350 | end
|
< 0.001 | 6 | 351 | numRows_j = size(arg,1);
|
< 0.001 | 6 | 352 | if argCnt == 1
|
< 0.001 | 6 | 353 | numRows = numRows_j;
|
| | 354 | elseif ~isequal(numRows_j,numRows)
|
| | 355 | ME = MException(message('MATLAB:table:UnequalVarLengths'));
|
| | 356 | if isstring(arg) && isscalar(arg) && numRows > 1
|
| | 357 | % A scalar string following inputs with more than one row
|
| | 358 | % is likely intended as a parameter name, give a helpful
|
| | 359 | % error.
|
| | 360 | cause = MException(message(StringParamNameNotSupportedErrID,arg));
|
| | 361 | ME = ME.addCause(cause);
|
| | 362 | end
|
| | 363 | throwAsCaller(ME);
|
< 0.001 | 6 | 364 | end
|
< 0.001 | 6 | 365 | end % while argCnt < numArgs, processing individual vars
|
< 0.001 | 8 | 366 | end
|
Other subfunctions in this file are not included in this listing.