How can I change cell array into strings
조회 수: 12 (최근 30일)
이전 댓글 표시
A ["an"] ["bn"] ["cn"] ["sb"]
How can I convert A into like this
'an' 'bn' 'cn' 'dn'
댓글 수: 0
채택된 답변
KL
2017년 11월 2일
편집: KL
2017년 11월 2일
cc = cellfun(@num2str,c,'uni',0)
if you have both string and numerics in cell array and you want to convert them all to char,
cc = cell(size(c));
for k=1:numel(c)
if(isnumeric(c{k}))
cc{k} = num2str(c{k});
elseif (isstring(c{k}))
cc{kk}= char(c{k});
%and so on
end
end
Another idea is,
cellfun(@(x) char(string(x)),c,'uni',0)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!