time | Calls | line |
---|
| | 150 | function [indices,numIndices,maxIndex,isLiteralColon,isLabels,updatedObj] ...
|
| | 151 | = subs2inds(obj,subscripts,subsType,tData)
|
| | 152 | %SUBS2INDS Convert table subscripts (labels, logical, numeric) to indices.
|
| | 153 |
|
| | 154 | import matlab.internal.datatypes.isColon
|
| | 155 |
|
0.007 | 110429 | 156 | try
|
0.030 | 110429 | 157 | oldLength = obj.length;
|
| | 158 |
|
0.006 | 110429 | 159 | if nargin < 3, subsType = matlab.internal.tabular.private.tabularDimension.subsType.reference; end
|
| | 160 |
|
| | 161 | % Translate a vartype subscript object into actual subscripts.
|
| | 162 | % Do this here, because the tabularDimension superclass's
|
| | 163 | % doesn't know that the vartype's getSubscripts needs to know
|
| | 164 | % the variable types.
|
0.006 | 110429 | 165 | if isobject(subscripts)
|
| | 166 | if isa(subscripts,'vartype')
|
| | 167 | subscripts = subscripts.getSubscripts(obj,tData);
|
| | 168 | end
|
0.005 | 110429 | 169 | end
|
| | 170 |
|
| | 171 | % Let the superclass handle the (rest of the) real work.
|
2.229 | 110429 | 172 | [indices,numIndices,maxIndex,isLiteralColon,isLabels,updatedObj] = ...
|
| 110429 | 173 | obj.subs2inds@matlab.internal.tabular.private.tabularDimension(subscripts,subsType);
|
| | 174 |
|
0.005 | 110429 | 175 | if isnumeric(subscripts)
|
0.002 | 40341 | 176 | if maxIndex > oldLength
|
| | 177 | if any(diff(unique([oldLength indices(:)'])) > 1)
|
| | 178 | error(message('MATLAB:table:DiscontiguousVars'));
|
| | 179 | end
|
0.002 | 40341 | 180 | end
|
| | 181 |
|
| | 182 | % Translate logical and ':' to indices, since table var indexing is not done by
|
| | 183 | % the built-in indexing code
|
0.003 | 70088 | 184 | elseif islogical(indices)
|
| | 185 | indices = find(indices);
|
0.132 | 70088 | 186 | elseif isColon(indices)
|
0.054 | 70088 | 187 | indices = 1:obj.length;
|
| | 188 | elseif isa(indices,'matlab.internal.ColonDescriptor')
|
| | 189 | indices = indices(:)';
|
0.012 | 110429 | 190 | end
|
| | 191 | catch ME
|
| | 192 | throwAsCaller(ME)
|
0.005 | 110429 | 193 | end
|
0.134 | 110429 | 194 | end
|
Other subfunctions in this file are not included in this listing.