Like this figure, I would like to sort this array with result (String).
Would I use sort funtion? the cell is 256*2 cell.
Thank you for reading !

 채택된 답변

Stephen23
Stephen23 2020년 2월 14일
편집: Stephen23 2020년 2월 14일

0 개 추천

Although the question is not very clear, I suspect that you might like to download and try my FEX submission natsortrows, which performs an alphanumeric sort on the rows of a cell array (of character vectors):
Alternatively you can simply convert the first column to double and sort that, e.g. where |C| is your cell array:
V = str2double(C(:,1));
[~,X] = sort(V);
D = C(X,:)
Note that this method only sorts by the values in the first column, the values in the second column are not taken into account.

댓글 수: 1

Jaewon Kim
Jaewon Kim 2020년 2월 15일
Thank you for your reply !!
It helped a lot me solve my problems!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

태그

질문:

2020년 2월 14일

댓글:

2020년 2월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by