Cody

Solution 785223

Submitted on 28 Nov 2015 by Peng Liu
  • Size: 10
  • 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 Status Code Input and Output
1   Pass
%% for ii=1:100 x = rand; clear y z; try y = check(x); catch z = 'error'; end end assert(isequal(y,x)) assert(isequal(exist('y','var'),1)) assert(isequal(exist('z','var'),0))

2   Pass
%% for ii=1:100 x = -rand; clear y z; try y = check(x); catch z = 'error'; end end assert(isequal(z,'error')) assert(isequal(exist('y','var'),0)) assert(isequal(exist('z','var'),1))

Suggested Problems

More from this Author46