필터 지우기
필터 지우기

how to swap this matrix

조회 수: 2 (최근 30일)
Anusha
Anusha 2013년 10월 17일
댓글: Anusha 2013년 10월 17일
Matrix
A=
9
3
4
5
6
7
find the min value in the matrix, and take that position
and swap this matrix
Z=
5
3
8
1
4
7
swap that min value Position in a A matrix and the first value in Z matrix

채택된 답변

Andrei Bobrov
Andrei Bobrov 2013년 10월 17일
편집: Andrei Bobrov 2013년 10월 17일
[v,ia] = min(A);
A(ia) = Z(1);
Z(1) = v;
ADD
[~,ia] = min(A);
Z([ia,1]) = Z([1,ia]);
  댓글 수: 3
Andrei Bobrov
Andrei Bobrov 2013년 10월 17일
corrected, see ADD part in answer.
Anusha
Anusha 2013년 10월 17일
yes thank you

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by