Change element in a vector
114 ビュー (過去 30 日間)
古いコメントを表示
Hi, I want change the elements: 2 with 6 and 6 with 2 in the first column of a matrix A
A=[1,2,4;2,3,5;6,4,6;2,5,6]
with a structure like this
A(A(:,1)==2)=6;
How can I do?
Thanks!
0 件のコメント
回答 (2 件)
KSSV
2017 年 5 月 9 日
A=[1,2,4;2,3,5;6,4,6;2,5,6] ;
B = A ;
A(B(:,1)==2,1) = 6 ;
A(B(:,1)==6,1) = 2 ;
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!