フィルターのクリア

how to Sorting a cell?

1 回表示 (過去 30 日間)
baby
baby 2013 年 1 月 21 日
コメント済み: dpb 2021 年 10 月 3 日
hello all,,
i want to ask u about how to sorting a cell which element is combination number and string
example
f =
[16] 'good'
[25] 'good'
[ 9] 'bad'
[13] 'bad'
i wanna sorting that cell by minimum value
how to make it?

採用された回答

Jan
Jan 2013 年 1 月 21 日
[dummy, index] = sort([f{:, 1}]);
sorted_f = f(index, :);
  3 件のコメント
Jan
Jan 2013 年 1 月 21 日
sorted_f(end-2:end, :)
baby
baby 2013 年 1 月 21 日
編集済み: baby 2013 年 1 月 21 日
thx u so much :)

サインインしてコメントする。

その他の回答 (1 件)

Thorsten
Thorsten 2013 年 1 月 21 日
編集済み: Thorsten 2013 年 1 月 21 日
[sorted ind] = sort([f{:, 1}]);
f = f(ind, :)
  4 件のコメント
baby
baby 2013 年 1 月 21 日
it just give one result like this
[9]
[13]
[16]
i want the result like this
[9] 'bad'
[13] 'bad'
[16] 'good'
how to make like that?
dpb
dpb 2021 年 10 月 3 日
nLow=3;
[f, ind] = sort([f{:, 1}]);
fLow = f(1:nLow, :)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by