Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
N = 101;
n = 3;
y_correct = 0.1200;
assert(abs(pidigit(N,n)-y_correct)<0.0001)
assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[101,201,202,203,1001]),regexp(fileread('pidigit.m'),'[\d\.\+\-\*\/]+','match')))) % modified from the comment of Alfonso on https://www.mathworks.com/matlabcentral/cody/problems/44343
ans =
0.1200
|
2 | Fail |
N = 201;
n = 6;
y_correct = 0.0750;
assert(abs(pidigit(N,n)-y_correct)<0.0001)
assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[101,201,202,203,1001]),regexp(fileread('pidigit.m'),'[\d\.\+\-\*\/]+','match'))))
ans =
0.0750
|
3 | Fail |
N = 202;
n = 6;
y_correct = 0.0796;
assert(abs(pidigit(N,n)-y_correct)<0.0001)
assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[101,201,202,203,1001]),regexp(fileread('pidigit.m'),'[\d\.\+\-\*\/]+','match'))))
ans =
0.0796
|
4 | Fail |
N = 203;
n = 6;
y_correct = 0.0792;
assert(abs(pidigit(N,n)-y_correct)<0.0001)
assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[101,201,202,203,1001]),regexp(fileread('pidigit.m'),'[\d\.\+\-\*\/]+','match'))))
ans =
0.0792
|
5 | Fail |
N = 1001;
n = 9;
y_correct = 0.1050;
assert(abs(pidigit(N,n)-y_correct)<0.0001)
assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[101,201,202,203,1001]),regexp(fileread('pidigit.m'),'[\d\.\+\-\*\/]+','match'))))
ans =
0.1050
|
How to find the position of an element in a vector without using the find function
2477 Solvers
1309 Solvers
Set the array elements whose value is 13 to 0
939 Solvers
Find nearest prime number less than input number
268 Solvers
249 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!