Cause of the Issue
As of MATLAB R2025b, "convertContainedStringsToChars" does not recursively process tables. It only converts strings inside cells or struct fields and leaves tables unchanged. This is documented behaviour.
Workaround
Use the "convertvars" function to convert table variables between supported types. For example, to convert string variables in a table to cell arrays of character vectors:
>> expected_output = table({'one'; 'two'})
>> string_table = table(["one"; "two"])
>> char_table = convertvars(string_table, vartype("string"), 'cellstr')
For additional information, please refer to the documentation page on the "covertvars" function. Answer from MathWorks Support Team on mathworks.com
MathWorks
mathworks.com › matlab › language fundamentals › data types › characters and strings
convertStringsToChars - Convert string arrays to character arrays, leaving other arrays unaltered - MATLAB
When working with your own code, you can use convertStringsToChars to make your code accept string inputs.
How can I convert strings inside tables back to character arrays using convertContainedStringsToChars in MATLAB R2025b?
I am working in MATLAB R2025b and using modern features like string arrays and tables. However, I need to maintain compatibility with a legacy codebase that requires outputs as char arrays or cell ... More on mathworks.com
Use string or character arrays in code?
Often I use sprintf, uigetfile or other character/string based basic functions (even a simple isa is an example) that needs an input to be either a string or a character (sometimes even a cellstr is a good way of doing it). Years ago when I was doing similar stuff in previous MATLAB release ... More on mathworks.com
How to convert an string array into a character array in Matlab? - Stack Overflow
Connect and share knowledge within a single location that is structured and easy to search. Learn more about Teams ... How can we convert the above string array into a character array by a function in Matlab like bellow? More on stackoverflow.com
Help with splitting a string into a character array.
Let's say I have a string s='Potato'. How would I split that up into an array so that it looks like t='P, o, t, a, t, o'? ... The only problem with doing it this way is that there are two blank spots and the beginning and end of the character array. It looks like this when outputted: ... https://www.mathworks.com/matlabcentral... More on mathworks.com
Videos
Matlab: Character and String Types (also binary and ...
12:19
MATLAB Video 4: Basic Strings, Concatenating Strings, and Char ...
14:00
Matlab - Using Character And String Arrays - YouTube
MATLAB Datatypes | Strings | Character | Using the MATLAB ...
00:55
Character vs String - MATLAB Data Type #Shorts - YouTube
03:36
Strings in MATLAB | ALL You Need To Know - YouTube
MathWorks
mathworks.com › matlab › language fundamentals › data types › data type conversion
char, ' ' - Character array - MATLAB
For example, the number 8451 corresponds to the symbol for degrees Celsius. Convert 8451 using char. ... Convert multiple arrays into a single character array. The input arrays need not have the same shape. ... Because the input arrays do not have the same number of columns, char pads the rows from A1 with blanks. ... Create a string scalar. You can create string scalars using double quotes. MATLAB...
MathWorks
mathworks.com › matlab › language fundamentals › data types › characters and strings
convertCharsToStrings - Convert character arrays to string arrays, leaving other arrays unaltered - MATLAB
B = convertCharsToStrings(A) converts A to a string array if A is a character array or a cell array of character vectors.
MathWorks
mathworks.com › matlab › language fundamentals › data types
Characters and Strings - MATLAB & Simulink
MATLAB stores all characters as Unicode characters. Both strings and character vectors use the same encoding. You can convert characters to their Unicode code values, and numbers to characters.
MathWorks
mathworks.com › matlab › language fundamentals › data types › data type conversion
num2str - Convert numbers to character array - MATLAB
Convert the floating-point values returned by pi and eps to character vectors. ... Specify the maximum number of significant digits for floating-point values. ... Display pi as a floating-point number to a specified precision. ... Input array, specified as a numeric array. Data Types: double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical Complex Number Support: Yes · Maximum number of significant digits in the output string, specified as a positive integer.
Stack Overflow
stackoverflow.com › questions › 44232509 › how-to-convert-an-string-array-into-a-character-array-in-matlab
How to convert an string array into a character array in Matlab? - Stack Overflow
s = "My String"; % Create a string with "" c = char(s); % This is how you convert string to char.
Reddit
reddit.com › r/matlab › what is the difference between character and string in matlab?
r/matlab on Reddit: What is the difference between character and string in MATLAB?
June 1, 2021 -
I have been reading MATLAB references for string here and for the character here.
In C language I can understand the difference between a single character and string but in MATLAB since everything is already defined as a matrix what would be the difference between character and string?
For example, I can define a='I am Character' and b="I am String". What would be the difference between these two applications? Any limitations in each in terms of usage?
Top answer 1 of 2
7
Character arrays are, as the name suggests, arrays of characters. So the length of your variable a is 14 elements. Indexing this array will return characters, so a(4) will return the character 'm'. String arrays are different because each element is a whole string. The length of your variable b is 1, and you can only index that string with b(1) . If you want the characters out of the string, you can get the character array with b{1} and then add the character index. So b{1}(4) will return the same character 'm'.
2 of 2
4
character arrays are matlabs old legacy text datatype, and strings give a newer, more potent way to store text. some differences are explained here
MathWorks
mathworks.com › matlabcentral › answers › 1778410-how-to-assign-strings-to-a-character-array
how to assign strings to a character array? - MATLAB Answers - MATLAB Central
August 12, 2022 - You can convert chars to strings using the string function. ... Otherwise, you will need to take into consideration the legnth of your char, meaning your assignment must include row and column indices.
Top answer 1 of 2
9
Use the following function: http://www.mathworks.com/help/matlab/ref/cellstr.html
>> B = cellstr(A)
B =
'APR'
'MAY'
>> B{1}
ans =
APR
2 of 2
2
For a 3D char array T
B = cellstr(T(1,:,:))
Gives the error
Error using cellstr (line 23)
S must be 2-D.
Instead assign it to a 2D matrix first, then use 'cellstr' as Franck suggested above.
A(:,:) = T(1,:,:)
B = cellstr(A)
MathWorks
mathworks.com › matlabcentral › answers › 57027-convert-char-to-string
Convert char to string - MATLAB Answers - MATLAB Central
December 20, 2012 - I just want to convert a char to str. The char is in a cell. This is what happens: >> example = ['hithere',socks] example = 'hithere' [1x34 char] >> taken = ['hit...
MathWorks
mathworks.com › matlabcentral › answers › 431985-how-to-convert-char-into-string
How to convert char into string? - MATLAB Answers - MATLAB Central
November 26, 2018 - I have "d879c14e5b1fa7a413aa46bbbc2b8710" this in char form and I want to convert this into string. As i want to split 2-2 character into binary so i want to split it into string. ... https://www.mathworks.com/matlabcentral/answers/431985-how-to-convert-char-into-string#comment_642392
MathWorks
mathworks.com › matlabcentral › answers › 339169-how-can-i-join-chars-to-a-string-vector
How can I join chars to a string vector? - MATLAB Answers - MATLAB Central
May 7, 2017 - If you really have a char array (85x19 is not a vector... these are not all that common now) and are using a recent version of MATLAB (I tested R2017a) then just call string on your array. If your array is a cellstr you should still be able to create a string array from it with the string constructor.
MathWorks
mathworks.com › matlab › language fundamentals › data types › data type conversion
Convert Numeric Values to Text - MATLAB & Simulink
str = 'Sine Wave, Frequency = ' + string(freq) + {' Hz'} ... If your data contains integers that represent Unicode® values, use the char function to convert the values to the corresponding characters.
MathWorks
mathworks.com › matlab › language fundamentals › data types › characters and strings
Create String Arrays - MATLAB & Simulink
You can index into, reshape, and ... type. You also can access the characters in a string and append text to strings using the plus operator. To rearrange strings within a string array, use functions such as split, join, and sort. MATLAB® provides string arrays to store pieces ...