- swapping a matrix
古いコメントを表示
a =
1 3 5 6 7
2 3 2 3 2
5 6 7 8 7
b=
5 2 1 3 7
6 8 2 3 1
5 7 8 6 3
how to swap b to a.
ans=
1 3 5 6 7
2 3 2 3 2
5 6 7 8 7
採用された回答
その他の回答 (1 件)
Andrew Newell
2014 年 4 月 23 日
I have two theories for what you mean:
b=a
just makes b equal to a. Or
z=b
b=a
a=z
8 件のコメント
Anusha
2014 年 4 月 23 日
Chandrasekhar
2014 年 4 月 23 日
do you want to assign the value of b to a? then you just have to do
a = b;
what is the receiver side variable in your question?
Anusha
2014 年 4 月 24 日
Geoff Hayes
2014 年 4 月 24 日
Are you expecting there to be some sort of general rule or function that maps the elements of b back to the elements of a? An "inverse mapping" of some kind?
Anusha
2014 年 4 月 24 日
Andrew Newell
2014 年 4 月 24 日
If you just supply a single example of a and b, there are an infinite number of rules that could map b to a. Do you have any other information?
Anusha
2014 年 4 月 24 日
Geoff Hayes
2014 年 4 月 24 日
Was there some sort of suggestion (or part of the problem description) that to do the swap you can use the unique values of a and b (retrieved via stable)?
カテゴリ
ヘルプ センター および File Exchange で Multidimensional Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!