Cody

Problem 2368. I want eval

Solution 2870699

Submitted on 23 Aug 2020 by Rafael S.T. Vieira
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 = 'a=[1 2 3 4 5];'; y_correct = 5; assert(isequal(your_fcn_name(x),y_correct))

2   Pass
x = 'a=ones(1,10);'; y_correct = 10; assert(isequal(your_fcn_name(x),y_correct));

3   Pass
x = 'a=zeros(0,0);'; y_correct = 0; assert(isequal(your_fcn_name(x),y_correct))

4   Pass
x = 'a=1:10'; y_correct = 10; assert(isequal(your_fcn_name(x),y_correct))

a = 1 2 3 4 5 6 7 8 9 10

5   Pass
x = 'a=1:2:10;'; y_correct = 5; assert(isequal(your_fcn_name(x),y_correct))

6   Pass
x = 'a=[];'; y_correct = 0; assert(isequal(your_fcn_name(x),y_correct))

7   Pass
x = 'a=ones(10,1);'; y_correct = 10; assert(isequal(your_fcn_name(x),y_correct));

Community Treasure Hunt

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

Start Hunting!