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 ExchangeShifting 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