"regexp" hack.
please check this code
problem : right angle or not
function flag = isrightangle(a,b,c)
if (c^2 == (b^2+a^2))
flag ='true'
else
flag = 'false'
end
end
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
x = [1 2 3 4
5 5 6 5
7 9 8 3];
y_correct = [0 0 0 4
0 0 6 0
0 9 0 0];
assert(isequal(your_fcn_name(x),y_correct))
ans =
[]
|
2 | Pass |
%%
x = magic(4);
y_correct = [16 0 0 0
0 11 0 0
0 0 0 12
0 0 15 0];
assert(isequal(your_fcn_name(x),y_correct))
ans =
[]
|
3 | Pass |
%%
x = pi;
y_correct = pi;
assert(isequal(your_fcn_name(x),y_correct))
ans =
[]
|
4 | Pass |
%%
x = 0;
y_correct = 0;
assert(isequal(your_fcn_name(x),y_correct))
ans =
[]
|
5 | Pass |
%%
x = toeplitz(1:5);
y_correct = [ 0 0 0 0 5
0 0 0 0 4
3 0 0 0 0
4 0 0 0 0
5 0 0 0 0];
assert(isequal(your_fcn_name(x),y_correct))
ans =
[]
|
6 | Pass |
%%
x = ones(5);
y_correct = [ 1 0 0 0 0
1 0 0 0 0
1 0 0 0 0
1 0 0 0 0
1 0 0 0 0];
assert(isequal(your_fcn_name(x),y_correct))
ans =
[]
|
7 | Pass |
%%
x =nchoosek(7:9,3);
y_correct =[ 0 0 9];
assert(isequal(your_fcn_name(x),y_correct))
ans =
[]
|
8 | Pass |
%%
x =nchoosek(4:9,2);
y_correct = [ 0 5
0 6
0 7
0 8
0 9
0 6
0 7
0 8
0 9
0 7
0 8
0 9
0 8
0 9
0 9];
assert(isequal(your_fcn_name(x),y_correct))
ans =
[]
|
Back to basics 9 - Indexed References
392 Solvers
694 Solvers
464 Solvers
530 Solvers
555 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!