Convert cell array to string

조회 수: 1 (최근 30일)
Willam Willam
Willam Willam 2013년 2월 25일
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
Jan
Jan 2013년 3월 1일
편집: Jan 2013년 3월 1일
@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".

댓글을 달려면 로그인하십시오.

답변 (2개)

Sean de Wolski
Sean de Wolski 2013년 2월 25일
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
Willam Willam
Willam Willam 2013년 3월 1일
excuse me.. it does not work
Jan
Jan 2013년 3월 1일
Sean has offered two possible solutions. Answering "it does not work" does not allow to improve them. Please, William, post enough details.

댓글을 달려면 로그인하십시오.


Jan
Jan 2013년 3월 1일
Guessed input:
d = [0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1];
str = char(d + '0');

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by