time | Calls | line |
---|
| | 250 | function exclStrOrElemToChk = validateExclStrOrElemToChk(exclStrOrElemToChk, inputStr)
|
| | 251 | % Validate EXCLUDEDSTRINGS or ELEMENTSTOCHECK.
|
< 0.001 | 8 | 252 | if matlab.internal.datatypes.isCharString(exclStrOrElemToChk) ...
|
| 8 | 253 | || ((isvector(exclStrOrElemToChk) || isempty(exclStrOrElemToChk)) ...
|
| 8 | 254 | && matlab.internal.datatypes.isCharStrings(exclStrOrElemToChk,true))
|
| | 255 | % exclStrOrElemToChk is a (potentially empty) char vector or cellstr.
|
< 0.001 | 8 | 256 | exclStrOrElemToChk = string(exclStrOrElemToChk);
|
| | 257 | elseif isnumeric(exclStrOrElemToChk) && isequaln(floor(exclStrOrElemToChk),exclStrOrElemToChk)
|
| | 258 | % Assume exclStrOrElemToChk is checkElements intended to be a range or
|
| | 259 | % linear indices into STRINGS.
|
| | 260 | exclStrOrElemToChk = reshape(exclStrOrElemToChk, 1, []);
|
| | 261 | if isempty(exclStrOrElemToChk)
|
| | 262 | % Nothing to check for uniqueness.
|
| | 263 | exclStrOrElemToChk = false(size(inputStr));
|
| | 264 | elseif min(exclStrOrElemToChk) <= 0 || ~isreal(exclStrOrElemToChk) ...
|
| | 265 | || any(isnan(exclStrOrElemToChk))
|
| | 266 | % Elements of the range must be positive.
|
| | 267 | error(message('MATLAB:makeUniqueStrings:NonPositiveRange'));
|
| | 268 | elseif max(exclStrOrElemToChk) > numel(inputStr)
|
| | 269 | % checkElements exceed the range of STRINGS number of elements.
|
| | 270 | error(message('MATLAB:makeUniqueStrings:OutOfBoundRange'));
|
| | 271 | end
|
| | 272 | elseif islogical(exclStrOrElemToChk)
|
| | 273 | % Assume exclStrOrElemToChk is checkElements when exclStrOrElemToChk is
|
| | 274 | % a logical array; the logical indices array must be the same length as
|
| | 275 | % STRINGS.
|
| | 276 | if ~isequal(numel(exclStrOrElemToChk), numel(inputStr))
|
| | 277 | error(message('MATLAB:makeUniqueStrings:BadLengthLogicalMask'));
|
| | 278 | end
|
| | 279 | elseif ~isstring(exclStrOrElemToChk)
|
| | 280 | % Though they are useless here, <missing> string values are allowed.
|
| | 281 | error(message('MATLAB:makeUniqueStrings:InvalidFirstOptionalArg'));
|
< 0.001 | 8 | 282 | end
|
< 0.001 | 8 | 283 | end
|
Other subfunctions in this file are not included in this listing.