Cell to String Conversion
이전 댓글 표시
I have created a cell from another cell with a 1,n dimension.
I would like to convert the values in the 1,n cell to a matrix of strings for a following if statement.
Is there a simple function for this conversion similar to cell2mat?
If not, what is the easiest way of achieving this conversion?
I don't want to specify the values in the cell manually, but rather have the code transcribe it, this would cater for dynamic cell values.
채택된 답변
추가 답변 (1개)
Hi, conversion cell to string is automatic. Eg: given a following cell X:
{1,1} -> [1 2 3]
{1,2} -> [aa bb cc]
now extract the 2nd element of X:
s=X{2};
s is now a string cell 1x3
now you can do a "for" loop to get string value of each element of the last cell like that:
x=s{i};
카테고리
도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!