Q&A
Ask and answer questions to make information more available to wider audiences.
Jesus Louie @louiejesus   18, Aug 2023 12:00 AM
convert a 1x1 cell to a character vector or string
How to convert a 1x1 cell to a character vector or string?
answers 1
 
Answer 1
Cesar Borne @bornecesar   30, Aug 2023 05:32 PM
To convert a cell array of character vectors to a character array, we use the char function.

A = {'line'}
B = char(A)
We could also extract the contents from a cell, index using curly braces.

A = {'line'}
B = A{1}
Finally, to convert a cell array to a string array, we use the string function.

A = {'line'}
B = string(A)