Cody

# Problem 44434. Writing Error Messages

Solution 1736149

Submitted on 25 Feb 2019 by Alfonso Nieto-Castanon
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
a = 1; b = 'hi there'; c = [1 0; 0 1]; try j = ErrorCheck(a,b,c); catch ME j = NaN; end assert(isequal(j,23)) clear ME

2   Pass
a = randi(50); b = 'aaaa'; for i = 1:4 b(i) = b(i) + randi(26) - 1; end c = randi(50,10,10); try j = ErrorCheck(a,b,c); catch ME j = NaN; end assert(j == 23) clear ME

3   Pass
a = '13'; b = 'I live for math.'; c = zeros(15); try j = ErrorCheck(a,b,c); catch ME j = NaN; end assert(strcmp(ME.message,'Cody demonstration error')) clear ME

4   Pass
a = pi; b = @(x)x^2; c = zeros(15); try j = ErrorCheck(a,b,c); catch ME j = NaN; end assert(strcmp(ME.message,'Cody demonstration error')) clear ME

5   Pass
a = 1e53; b = 'Life Before Death!'; c = [1 2 3; 4 5 6]; try j = ErrorCheck(a,b,c); catch ME j = NaN; end assert(strcmp(ME.message,'Cody demonstration error')) clear ME

6   Pass
a = 1e53; b = 'This is a string'; c = "Journey Before Destination"; try j = ErrorCheck(a,b,c); catch ME j = NaN; end assert(strcmp(ME.message,'Cody demonstration error')) clear ME

7   Pass
a = log(27); b = "This is a string too"; c = []; try j = ErrorCheck(a,b,c); catch ME j = NaN; end assert(j == 23) clear ME