Borrar filtros
Borrar filtros

converting cell array full of characters to a string

2 visualizaciones (últimos 30 días)
Alex
Alex el 15 de Dic. de 2011
This is probably easy but I can't figure it out. I have a cell array where each entry is a character. I want to convert this cell array to a string because the characters in the cell array form a sentence. I tried char(array) which sort of works except it displays the string vertically instead of horizontally.

Respuesta aceptada

Sean de Wolski
Sean de Wolski el 15 de Dic. de 2011
How about:
A = {'the';'quick';'brown';'fox'}
char(A)
or
char(cellfun(@transpose,A,'uni',false))
etc depending on how you want to convert it.
  4 comentarios
Alex
Alex el 15 de Dic. de 2011
Thanks
Jan
Jan el 15 de Dic. de 2011
Or if the elements are scalar characters: cat(1, A{:})'

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by