How can I convert strings inside tables back to character arrays using convertContainedStringsToChars in MATLAB R2025b?
Mostrar comentarios más antiguos
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 arrays of characters.
I normally use the "convertContainedStringsToChars" function before passing data back to the legacy code. This works for cells and structs, but when I try to use it on a table that contains string variables, the function does not convert the strings back to char arrays.
Reproduction steps:
>> expected_output = table({'one'; 'two'})
>> string_table = table(["one"; "two"])
>> char_table = convertContainedStringsToChars(string_table)
The output:

What is the cause of this issue?
Is there a way to make "convertContainedStringsToChars" handle tables recursively, or is there a recommended workaround to achieve this conversion?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!