Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 356519

Submitted on 20 Nov 2013 by Alfonso Nieto-Castanon

Correct

8Size
This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
aIn = 10;
bIn = 20;
aOut_correct = 20;
bOut_correct = 10;
[aOut,bOut] = swapit(aIn,bIn);
assert(isequal(aOut, aOut_correct))
assert(isequal(bOut, bOut_correct))

                    
2
Pass
 
%%
aIn = 0;
bIn = -3;
aOut_correct = -3;
bOut_correct = 0;
[aOut,bOut] = swapit(aIn,bIn);
assert(isequal(aOut, aOut_correct))
assert(isequal(bOut, bOut_correct))