Swap between 3 Matrix

Hello, I have a question, can you use the swap command between 3 matrix? I have an array A, one B and one V and I have to exchange values ​​between them 3 in a single command line

回答 (1 件)

KSSV
KSSV 2020 年 6 月 1 日

1 投票

Save the below into a function and run in command line.
function [n1,n2,n3] = swap(n1,n2,n3) ;
temp = n2 ;
n2 = n1 ;
n1 = n3 ;
n3 = temp ;
end
Running:
a = rand(2) ; b = rand(2) ; c = rand(2) ;
[a,b,c] = rand(a,b,c) ;

2 件のコメント

Angel David Gómez Aldape
Angel David Gómez Aldape 2020 年 6 月 1 日
Thx man
KSSV
KSSV 2020 年 6 月 1 日
Thanks is accepting the answer. :)

この質問は閉じられています。

製品

リリース

R2020a

タグ

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by