A=[1 2 3;4 5 6;7 8 9]
A =
1 2 3
4 5 6
7 8 9
How can I convert the above matrix into
A={'1' '2' '3';'4' '5' '6';'7' '8' '9'}
=
3×3 cell array
'1' '2' '3'
'4' '5' '6'
'7' '8' '9'

 채택된 답변

KL
KL 2017년 10월 31일
편집: KL 2017년 10월 31일

0 개 추천

c = num2cell(A)
EDIT:
I just realized you want to convert them to char,
c = arrayfun(@num2str, A, 'uni',0)

댓글 수: 2

A=[2 28];
B=num2cell(A)
B =
1×2 cell array
[2] [28]
>> length(B{2})
ans =
1
I want the answer of length(B{2}) should be 2. If B is {'2','28'} then length(B{2}) is 2.
KL
KL 2017년 10월 31일
see my edited answer.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Types에 대해 자세히 알아보기

태그

질문:

2017년 10월 31일

댓글:

KL
2017년 10월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by