position of the element have small value

A=
3 4 5 6 7
1 2 4 9 4
5 3 0 7 6
6 0 1 8 5
2 9 8 1 3
find the position of min value in each column sore the position in the variable
for first coln min value is 1 now the position (1,2) p=1 q=2 like that next iteration take second column and find the position

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2013년 10월 22일

0 개 추천

[~,ii] = min(A);
position_pq = [1:size(A,2);ii];

추가 답변 (1개)

David Sanchez
David Sanchez 2013년 10월 22일

0 개 추천

A= [
3 4 5 6 7;
1 2 4 9 4;
5 3 0 7 6;
6 0 1 8 5;
2 9 8 1 3];
[C I] = min(A,[],1);
C is the array of minima.
I is an array with the positions of the minimum value in the columns of A.

댓글 수: 1

Anusha
Anusha 2013년 10월 22일
the position will be store like (x,y) the variable I store (y) only
from the answer only i want swap some matrix so i need (x,y) position for first col not only (2).. need (1,2)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

질문:

2013년 10월 22일

답변:

2013년 10월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by