convertContainedStringsToChars
Convert string arrays at any level of cell array or structure
Description
To make your code accept cell arrays and structures that contain strings as input
arguments, add a call to convertContainedStringsToChars to the beginning
of your code. Then you do not have to make any other changes to code that you had written to
work with cell arrays or structures containing character arrays.
B = convertContainedStringsToChars( converts
string arrays at any level in A)A.
If
Ais a string array, thenBis a character vector or cell array of character vectors.If
Ais a cell array or a structure, then string arrays in any cell or field ofAbecome character vectors or cell arrays of character vectors inB. All other cells or fields ofAare unaltered inB.Otherwise, the function returns
Aunaltered.
[B1,...,Bn] = convertContainedStringsToChars(A1,...,An) converts
the input arguments A1,...,An. For every input argument, there must be a
corresponding output argument in B1,...,Bn.
Examples
Input Arguments
Extended Capabilities
Version History
Introduced in R2018b
See Also
string | isstring | convertCharsToStrings | convertStringsToChars | isStringScalar | ischar | validateattributes