Cody

Problem 2850. Matlab Basics - Switching Assignments

Solution 592858

Submitted on 7 Mar 2015 by @bmtran (Bryant Tran)
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% [x,y] = swap_vars(5,10); assert(isequal(x,10)); assert(isequal(y,5));

2   Pass
%% [x,y] = swap_vars('hello','bye'); assert(isequal(x,'bye')); assert(isequal(y,'hello'));

3   Pass
%% [x,y] = swap_vars(5,'hello'); assert(isequal(x,'hello')); assert(isequal(y,5));

Suggested Problems

More from this Author28

Community Treasure Hunt

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

Start Hunting!