How to sort only nonzeros values of an array that is linked to cell array ?
1 回表示 (過去 30 日間)
古いコメントを表示
Hello,
I did a combination between 5 elements (A, B, C, D, E). Each combination corresponds to a value. As shown below.
T =
6×3 cell array
{'A' } {'D'} {[ 0]}
{'B'} {'D'} {[ 0]}
{'C'} {'D'} {[ 0]}
{'A' } {'E' } {[ 0]}
{'B'} {'E' } {[6.008]}
{'C'} {'E' } {[4.385]}
Now I would like to sort in another matrix, with only non zeros values, by keeping the relation between number and combinations.
For example,
I need to extract 6.008 and I want that it shows that this numbers correponds to {'B'} and {'E' }
Could you help me ?
3 件のコメント
採用された回答
madhan ravi
2019 年 3 月 22 日
[~,I] = sort(vertcat(T{:,3}));
sorted_T = T(I,:);
Corresponding_matche_s = T(vertcat(T{:,3})==6.008,:)
6 件のコメント
madhan ravi
2019 年 3 月 22 日
編集済み: madhan ravi
2019 年 3 月 22 日
D = d( I, : );
New = D( cat( 1, D{:,3} ) < 5, : )
https://in.mathworks.com/learn/tutorials/matlab-onramp.html - please have a look at it , useful and free to learn Matlab.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!