time | Calls | line |
---|
| | 101 | function obj = checkAgainstVarLabels(obj,varLabels,errorMode)
|
| | 102 | import matlab.internal.datatypes.warningWithoutTrace
|
| | 103 | % Pre-2016b, DimensionNames were not required to be distinct from VariableNames,
|
| | 104 | % but now they are. The caller may ask to error if they conflict, or to modify
|
| | 105 | % DimensionNames with a warning or silently.
|
0.017 | 8 | 106 | [modifiedLabels,wasConflicted] = matlab.lang.makeUniqueStrings(obj.labels,varLabels,namelengthmax);
|
< 0.001 | 8 | 107 | matlab.internal.tabular.validateVariableNameLength(obj.labels,'MATLAB:table:DimNameLengthMax');
|
< 0.001 | 8 | 108 | if any(wasConflicted)
|
| | 109 | if nargin > 2
|
| | 110 | switch errorMode
|
| | 111 | case 'silent'
|
| | 112 | % OK
|
| | 113 | case 'warn'
|
| | 114 | warningWithoutTrace(message('MATLAB:table:DuplicateDimNamesVarNamesWarn',obj.labels{find(wasConflicted,1)}));
|
| | 115 | case 'error'
|
| | 116 | throwAsCaller(MException(message('MATLAB:table:DuplicateDimNamesVarNames',obj.labels{find(wasConflicted,1)})));
|
| | 117 | case 'warnBackCompat' % Only used for table loadobj. From 2019b on, table dimname-varname clashes typically error.
|
| | 118 | warningWithoutTrace(message('MATLAB:table:DuplicateDimnamesVarnamesBackCompat',obj.labels{find(wasConflicted,1)}));
|
| | 119 | otherwise
|
| | 120 | assert(false);
|
| | 121 | end
|
| | 122 | else
|
| | 123 | throwAsCaller(MException(message('MATLAB:table:DuplicateDimNamesVarNames',obj.labels{find(wasConflicted,1)})));
|
| | 124 | end
|
| | 125 | obj.labels = modifiedLabels;
|
< 0.001 | 8 | 126 | end
|
< 0.001 | 8 | 127 | end
|
Other subfunctions in this file are not included in this listing.