time | Calls | line |
---|
| | 110 | function obj = lengthenTo(obj,maxIndex,newLabels)
|
< 0.001 | 785 | 111 | newIndices = (obj.length+1):maxIndex;
|
< 0.001 | 785 | 112 | if nargin < 3
|
| | 113 | % Create default names for the new vars, making sure they don't conflict with
|
| | 114 | % existing names.
|
| | 115 | newLabels = obj.dfltLabels(newIndices);
|
| | 116 | newLabels = matlab.lang.makeUniqueStrings(newLabels,obj.labels,namelengthmax);
|
| | 117 | obj.labels(1,newIndices) = newLabels(:);
|
< 0.001 | 785 | 118 | else
|
| | 119 | % Assume that newLabels has already been checked by validateNativeSubscripts as
|
| | 120 | % names, and that the new names don't conflict with existing names. But still have
|
| | 121 | % to make sure the names are legal.
|
0.013 | 785 | 122 | obj.makeValidName(newLabels,'error');
|
| | 123 |
|
0.019 | 785 | 124 | obj.labels(1,newIndices) = newLabels(:);
|
< 0.001 | 785 | 125 | end
|
< 0.001 | 785 | 126 | obj.length = maxIndex;
|
| | 127 |
|
| | 128 | % Per-var properties need to be lengthened.
|
< 0.001 | 785 | 129 | if obj.hasDescrs, obj.descrs(1,newIndices) = {''}; end
|
< 0.001 | 785 | 130 | if obj.hasUnits, obj.units(1,newIndices) = {''}; end
|
< 0.001 | 785 | 131 | if obj.hasContinuity, obj.continuity(1,newIndices) = 'unset'; end
|
< 0.001 | 785 | 132 | if obj.hasCustomProps
|
| | 133 | import matlab.internal.datatypes.defaultarrayLike
|
| | 134 | f = fieldnames(obj.customProps);
|
| | 135 | for i = 1:numel(f)
|
| | 136 | if ~isequal(size(obj.customProps.(f{i})),[0,0])
|
| | 137 | obj.customProps.(f{i})(1,newIndices) = defaultarrayLike([1,numel(newIndices)],'Like', obj.customProps.(f{i}),false);
|
| | 138 | end
|
| | 139 | end
|
< 0.001 | 785 | 140 | end
|
< 0.001 | 785 | 141 | end
|
Other subfunctions in this file are not included in this listing.