Effacer les filtres
Effacer les filtres

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 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

Maxi
Maxi le 17 Mai 2021
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

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by