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 Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by