time | Calls | line |
---|
| | 409 | function [subscripts,indices] = validateNativeSubscripts(obj,subscripts)
|
| | 410 | import matlab.internal.datatypes.isText
|
| | 411 |
|
< 0.001 | 5668 | 412 | subscripts = convertStringsToChars(subscripts);
|
| | 413 |
|
| | 414 | % Default behavior assumes the labels are names, subclasses with
|
| | 415 | % non-name labels need to overload.
|
< 0.001 | 5668 | 416 | if ischar(subscripts) % already weeded out ':'
|
| | 417 | if isrow(subscripts)
|
| | 418 | subscripts = { subscripts };
|
| | 419 | else
|
| | 420 | obj.throwInvalidLabel();
|
| | 421 | end
|
0.075 | 5668 | 422 | elseif isText(subscripts,true) % require a cell array or string array, don't allow empty character vectors in it
|
| | 423 | % Don't allow scalar missing string or "", and handle it the
|
| | 424 | % same as ''.
|
< 0.001 | 5668 | 425 | if isstring(subscripts) && isscalar(subscripts) && strlength(subscripts) < 1
|
| | 426 | obj.throwInvalidLabel();
|
< 0.001 | 5668 | 427 | end
|
| | 428 | else
|
| | 429 | obj.throwInvalidSubscripts();
|
< 0.001 | 5668 | 430 | end
|
| | 431 |
|
0.013 | 5668 | 432 | indices = zeros(size(subscripts));
|
0.003 | 5668 | 433 | labs = obj.labels;
|
< 0.001 | 5668 | 434 | for i = 1:numel(indices)
|
0.042 | 5668 | 435 | indFirstMatch = find(strcmp(subscripts{i},labs), 1);
|
< 0.001 | 5668 | 436 | if indFirstMatch
|
< 0.001 | 5668 | 437 | indices(i) = indFirstMatch;
|
< 0.001 | 5668 | 438 | end
|
< 0.001 | 5668 | 439 | end
|
0.008 | 5668 | 440 | end
|
Other subfunctions in this file are not included in this listing.