Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
x = 1:20;
m = 3;
y = wrapnan(x,m);
y_correct = [1 2 nan 0 1 2 nan 0 1 2 nan 0 1 2 nan 0 1 2 nan 0 1 2 nan 0 1 2];
assert(isequaln(y,y_correct))
filetext = fileread('wrapnan.m');
assert(isempty(strfind(filetext, 'regexp')),'regexp* command is forbidden');
assert(isempty(strfind(filetext, 'eval')),'eval* command is forbidden');
assert(isempty(strfind(filetext, 'inline')),'inline command is forbidden');
|
2 | Pass |
%%
x = [1 50 95 105 195 205 190 310 290 250 201 10];
m = 100;
y = wrapnan(x,m);
y_correct = [1 50 95 nan 5 95 nan 5 nan 90 nan 10 nan 90 50 1 nan 10];
assert(isequaln(y,y_correct))
|
3 | Pass |
%%
x = [0.25 0.45 0.80 0.90 1.25 0.60 0.10 0.20 1.70 1.60 1.50 1.80 1.40 0.10];
m = 0.5;
y = wrapnan(x,m);
y_correct = [0.25 0.45 NaN 0.30 0.40 NaN 0.25 NaN 0.10 NaN 0.10 0.20 NaN 0.20 0.10 0.00 0.30 NaN 0.40 NaN 0.10];
assert(isequaln(roundn(y,2),roundn(y_correct,2)))
|
556 Solvers
63 Solvers
Getting the indices from a matrice
360 Solvers
111 Solvers
37 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!