time | Calls | line |
---|
| | 211 | function [validNames, modified] = makeValidName(names, modException)
|
| | 212 | %MAKEVALIDNAME Construct valid table row names. The only row
|
| | 213 | % not allowed is ':' to avoid ambiguous subscripting.
|
| | 214 | %
|
| | 215 | % MODEXCEPTION controls warning or error response when NAMES
|
| | 216 | % contains invalid names. Valid values for MODEXCEPTION are
|
| | 217 | % 'silent' and 'error'.
|
| | 218 | import matlab.internal.datatypes.warningWithoutTrace;
|
| | 219 | import matlab.internal.tabular.private.rowNamesDim.checkReservedNames;
|
| | 220 |
|
< 0.001 | 8 | 221 | if strcmp(modException,'error')
|
< 0.001 | 8 | 222 | validNames = names; % return the originals, or possibly error
|
< 0.001 | 8 | 223 | if ischar(names), names = { names }; end % unusual case, not optimized
|
0.002 | 8 | 224 | checkReservedNames(names);
|
< 0.001 | 8 | 225 | modified = false(size(names));
|
| | 226 | else % make names valid
|
| | 227 | validNames = names;
|
| | 228 | conflicted = checkReservedNames(names);
|
| | 229 | if any(conflicted)
|
| | 230 | validNames(conflicted) = matlab.lang.makeUniqueStrings(validNames(conflicted), validNames,namelengthmax);
|
| | 231 | end
|
| | 232 | modified = conflicted;
|
| | 233 | if any(modified)
|
| | 234 | switch modException % error or warn per level specified
|
| | 235 | case 'silent'
|
| | 236 | % Only used by readtable
|
| | 237 | case 'warn' % Only used by loadobj
|
| | 238 | warningWithoutTrace(message('MATLAB:table:RowNameReservedBackCompat'));
|
| | 239 | otherwise
|
| | 240 | assert(false);
|
| | 241 | end
|
| | 242 | end
|
< 0.001 | 8 | 243 | end
|
< 0.001 | 8 | 244 | end
|
Other subfunctions in this file are not included in this listing.