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.
댓글 수: 0
채택된 답변
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 Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!