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 中查找有关 Get Started with MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by