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
댓글 수: 0
답변 (1개)
KSSV
2020년 6월 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) ;
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!