swaping values in matrix
古いコメントを表示
how do i use a for loop to change the matrix
B= [1 0 0;
0 1 0;
0 0 1]
to
A= [0 0 1;
0 1 0;
1 0 0]
for any size matrix
2 件のコメント
James Tursa
2017 年 1 月 26 日
編集済み: James Tursa
2017 年 1 月 26 日
What are the rules for changing any size matrix? Exchange the (1,1) element with the (1,end) position? Flip the order of all of the elements of the 1st row? Or what? I can think of several rules that would fit your small example. And why do you need to use a for loop for this? Is that a homework requirement?
Morgan Kaye
2017 年 1 月 26 日
回答 (1 件)
Guillaume
2017 年 1 月 26 日
C = fliplr(B);
for i = 1:10000
%twiddle thumbs
end
I suggest you make an attempt at solving this extremely easy problem and then come back with a very specific question if you encounter a problem.
カテゴリ
ヘルプ センター および File Exchange で Operating on Diagonal Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!