Working with a cell of strings

4 visualizaciones (últimos 30 días)
L'O.G.
L'O.G. el 3 de Dic. de 2022
Respondida: Voss el 3 de Dic. de 2022
I have a large N x 1 array of cells, each cell containing a string. How do I convert this to a string array, or to a cell array of character vectors?

Respuesta aceptada

Voss
Voss el 3 de Dic. de 2022
Use string or cellstr.
C = {"one";"two"}
C = 2×1 cell array
{["one"]} {["two"]}
string(C)
ans = 2×1 string array
"one" "two"
cellstr(C)
ans = 2×1 cell array
{'one'} {'two'}

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by