Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = [1 4 6 8 10];
n=1;
y_correct = 1;
assert(isequal(trcatch(x,n),y_correct))
a =
'try missing'
b =
'Catch missing'
y =
1
|
2 | Pass |
filetext = fileread('trcatch.m');
assert(~isempty(strfind(filetext, 'try')),'try missing')
assert(~isempty(strfind(filetext, 'catch')),'Catch missing')
|
3 | Pass |
x = [1 4 6 8 10];
n=0;
y_correct = 0;
assert(isequal(trcatch(x,n),y_correct))
a =
'try missing'
b =
'Catch missing'
y =
0
|
4 | Pass |
x = [1 4 6 8 10];
n=6;
y_correct = 0;
assert(isequal(trcatch(x,n),y_correct))
a =
'try missing'
b =
'Catch missing'
y =
0
|
5 | Pass |
x = [1 4 6 8 10];
n=5;
y_correct = 10;
assert(isequal(trcatch(x,n),y_correct))
a =
'try missing'
b =
'Catch missing'
y =
10
|
6 | Pass |
x = [1 4 6 8 10];
n=-25;
y_correct = 0;
assert(isequal(trcatch(x,n),y_correct))
a =
'try missing'
b =
'Catch missing'
y =
0
|
7 | Pass |
x = [1 4 6 8 10];
n=3;
y_correct = 6;
assert(isequal(trcatch(x,n),y_correct))
a =
'try missing'
b =
'Catch missing'
y =
6
|
579 Solvers
359 Solvers
168 Solvers
175 Solvers
Replace every 3rd element in a vector with 4
170 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!