Write a function that swaps two numbers x and y. Example, if x=5 and y=20, then after the function is called the new values of x and y should be x=20 and y=5. Write the code.

19 次查看(过去 30 天)
x=5 y=20

回答(1 个)

C.J. Harris
C.J. Harris 2014-6-30
[x,y] = deal(y,x)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by