Info

この質問は閉じられています。 編集または回答するには再度開いてください。

could anyone help me how to arrange the following result in descending order as i am getting error

1 回表示 (過去 30 日間)
Prabha Kumaresan
Prabha Kumaresan 2018 年 4 月 12 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Result:
o_th(:,:,1) =
[0]
o_th(:,:,2) =
[4.1615e+07]
o_th(:,:,3) =
[5.5254e+07]
o_th(:,:,4) =
[5.1183e+07]
o_th(:,:,5) =
[2.4474e+08]
when i used the command
sort(o_th(:,:,:),'descend')
it results in error stating Error using sort DIM and MODE arguments not supported for cell arrays.
could anyone help me to fix it.

回答 (1 件)

dpb
dpb 2018 年 4 月 12 日
Use cell2mat on the cell array first, then sort on whatever dimension or subreference of the array you need.
  2 件のコメント
Prabha Kumaresan
Prabha Kumaresan 2018 年 4 月 13 日
i tried with the following command
three = cell2mat(sort(o_th(:,:,:),'descend'))
but it results in Error using sort
DIM and MODE arguments not supported for cell arrays.
and three =sort(cell2mat(o_th(:,:,:),'descend')) results in Error using cell2mat
Too many input arguments.
dpb
dpb 2018 年 4 月 13 日
Well, that's no different than what you had before for SORT()
o_th=cell2mat(o_th); % convert to double from cell array
three=sort(o_th(:,:,1),'descend');

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by