Cody

Problem 43963. Finding operators in a MATLAB function in a string.

Solution 1215744

Submitted on 19 Jun 2017 by Said BOUREZG
• Size: 11
• 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
x = 'min(var1+var2,2)'; y_correct = true; assert(isequal(FindingOperators(x),y_correct))

ans = ''

2   Pass
x = 'min(1,2)+min(3,4)'; y_correct = false; assert(isequal(FindingOperators(x),y_correct))

ans = ' '

3   Pass
x = 'min(min(1,2),3))'; y_correct = false; assert(isequal(FindingOperators(x),y_correct))

ans = ' '

4   Pass
x = 'min(min(1,var1+2),3))'; y_correct = true; assert(isequal(FindingOperators(x),y_correct))

ans = ''

5   Pass
x = '4*var1'; y_correct = false; assert(isequal(FindingOperators(x),y_correct))

ans = ' '

6   Pass
x = '4*(var1+2)'; y_correct = false; assert(isequal(FindingOperators(x),y_correct))

ans = ' '

7   Pass
x = 'max(min(1,var1-2),3))'; y_correct = true; assert(isequal(FindingOperators(x),y_correct))

ans = ''

8   Pass
x = '4+abs(2)'; y_correct = false; assert(isequal(FindingOperators(x),y_correct))

ans = ' '

9   Pass
x = '4+abs(2/var1)'; y_correct = true; assert(isequal(FindingOperators(x),y_correct))

ans = ''

10   Pass
x = '4+abs(2+min(1+5,1))'; y_correct = true; assert(isequal(FindingOperators(x),y_correct))

ans = ''

11   Pass
x = '4+max(2,min(1+5,1))'; y_correct = true; assert(isequal(FindingOperators(x),y_correct))

ans = ''

12   Pass
x = '4+max((2,min(1+5,1)))'; y_correct = true; assert(isequal(FindingOperators(x),y_correct))

ans = ''

13   Pass
x = 'min(2-1,1)+abs(-5)'; y_correct = true; assert(isequal(FindingOperators(x),y_correct))

ans = ''

14   Pass
x = 'min(var1,1)+abs(-5)'; y_correct = false; assert(isequal(FindingOperators(x),y_correct))

ans = ' '

15   Pass
x = 'min(min(var1,var2),1+3)'; y_correct = true; assert(isequal(FindingOperators(x),y_correct))

ans = ''