Convert cell array to string

Hi. I want to ask how do I want to convert below example to a string which contains data in char. Eg: retrieveblock =
0 1 1 1 0 0 0 1 0 1 1 0 0 0 0 1

1 comentario

Jan
Jan el 1 de Mzo. de 2013
Editada: Jan el 1 de Mzo. de 2013
@William: Please post the input data such that we can know the class and the size. Currently it is not clear, if your data are a double vector, a cell vector or any equivalent data also. But guessing this detail wastes time.
Please use meaningful tags, because they are used to classify the questions. All questions in this forum concern "matlab".

Iniciar sesión para comentar.

Respuestas (2)

Sean de Wolski
Sean de Wolski el 25 de Feb. de 2013

2 votos

x = rand(1,10)>0.5;
num2str(x)
If x was a cell array of strings you could always call char()
x = cellstr(num2str(rand(1,10)>0.5));
char(ans)

2 comentarios

Willam Willam
Willam Willam el 1 de Mzo. de 2013
excuse me.. it does not work
Jan
Jan el 1 de Mzo. de 2013
Sean has offered two possible solutions. Answering "it does not work" does not allow to improve them. Please, William, post enough details.

Iniciar sesión para comentar.

Jan
Jan el 1 de Mzo. de 2013

1 voto

Guessed input:
d = [0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1];
str = char(d + '0');

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Productos

Etiquetas

Aún no se han introducido etiquetas.

Preguntada:

el 25 de Feb. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by