建立一个脚本M文件将向量a,b的值互换,用matlab做,求高手!!!

2024-12-19 14:17:49
推荐回答(3个)
回答1:

直接运算就可以了,比如:a = [0 0 0];b = [1 2 3 4];c = b;b = a;a = c;

回答2:

a = 5; b = 10;

>>a = a+b;
b = a-b;
a = a-b;
disp(a)
disp(b)

回答3:

c = a;
a = b;
b = c;