フィルターのクリア

How to operate on One Column of A matrix while the other Columns stay connected row-wise to the column we are operating on

4 ビュー (過去 30 日間)
Hi, sorry for bad wording but suppose i have this matrix
A =
1 2
1 3
2 5
2 4
4 2
6 1
8 1
I want to find the maximum of the first column while still connect the second value to the output for example if i ask the output of max 1st column of A itu will return the value of :
8 1
moreover, I want to rank the matrix from the largest value, based on column 1 while still connect the first column to the second, the desired output is this:
8 1
6 1
4 2
2 5
2 4
1 3
1 2
how can i do that?
lastly i want to find the average of the third largest value of the above matrix, based on the value of the first column, column wise. The desired output is this:
6 1.333
again, I'm sorry for bad wording, Any help will be greatly appreciated.

採用された回答

Maxi
Maxi 2021 年 5 月 17 日
first problem could be solved with
index_max=find(max(A(:,1))==A(:,1)) %find the index of the largest value in the first column
A(index_max,:)
>>ans =
8 1

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by