time | Calls | line |
---|
| | 1 | function s = stringToLegacyText(s,scalarCellOutput)
|
| | 2 | %STRINGTOLEGACYTEXT Convert string array to char or cellstr.
|
| | 3 | % S = STRINGTOLEGACYTEXT(S) converts the string array S to a char row vector,
|
| | 4 | % if S is a scalar, or to a cellstr, if S is not a scalar. If S is not a
|
| | 5 | % string array, it is returned as is. Missing strings are converted into the
|
| | 6 | % empty character vector, ''.
|
| | 7 | %
|
| | 8 | % S = STRINGTOLEGACYTEXT(S,TRUE) always converts a string array S to cellstr,
|
| | 9 | % even if S is a scalar. If S is a char row vector, STRINGTOLEGACYTEXT(S,TRUE)
|
| | 10 | % does not convert it to a scalar cellstr.
|
| | 11 |
|
| | 12 | % Copyright 2017 The MathWorks, Inc.
|
| | 13 |
|
< 0.001 | 90 | 14 | if isstring(s)
|
| | 15 | % Convert missing string to empty string so that they can be converted into
|
| | 16 | % empty character vectors.
|
| | 17 | s(ismissing(s)) = "";
|
| | 18 |
|
| | 19 | if isscalar(s)
|
| | 20 | if nargin < 2 || ~scalarCellOutput
|
| | 21 | s = char(s);
|
| | 22 | else
|
| | 23 | s = cellstr(s);
|
| | 24 | end
|
| | 25 | else % cellstr instead of character matrix
|
| | 26 | s = cellstr(s);
|
| | 27 | end
|
< 0.001 | 90 | 28 | end
|
Other subfunctions in this file are not included in this listing.