Although my method is stupid and complicated,it still works.
function X = rescale_scores(X)
rown=length(X(1,:));
cn=length(X(:,1));
for c=1:cn
if X(c,rown)>=90
A=rescale([90,X(c,rown),100],3,4);
X(c,rown)=A(2);
elseif X(c,rown)>=80
A=rescale([80,X(c,rown),90],2,3);
X(c,rown)=A(2);
elseif X(c,rown)>=70
A=rescale([70,X(c,rown),80],1,2);
X(c,rown)=A(2);
else
A=rescale([60,X(c,rown),70],0,1);
X(c,rown)=A(2);
end
end
end
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = [100 90 95 95; ...
70 50 60 60; ...
80 70 90 80];
y_correct = [100 90 95 3.5;...
70 50 60 0.0;...
80 70 90 2.0;];
assert(all(abs(rescale_scores(x) - y_correct) < 1e-3, 'all'))
|
2 | Pass |
x = [54.0000 73.0000 97.0000 79.0000 60.0000 72.6000;...
61.0000 58.0000 89.0000 63.0000 65.0000 67.2000;...
90.0000 85.0000 74.0000 89.0000 74.0000 82.4000;...
42.0000 81.0000 72.0000 61.0000 93.0000 69.8000;...
50.0000 51.0000 65.0000 97.0000 59.0000 64.4000;...
79.0000 62.0000 75.0000 93.0000 61.0000 74.0000;...
84.0000 78.0000 76.0000 73.0000 58.0000 73.8000;...
79.0000 87.0000 91.0000 77.0000 61.0000 79.0000;...
67.0000 44.0000 90.0000 75.0000 72.0000 69.6000];
y_correct = [54.0000 73.0000 97.0000 79.0000 60.0000 1.2600;...
61.0000 58.0000 89.0000 63.0000 65.0000 0.7200;...
90.0000 85.0000 74.0000 89.0000 74.0000 2.2400;...
42.0000 81.0000 72.0000 61.0000 93.0000 0.9800;...
50.0000 51.0000 65.0000 97.0000 59.0000 0.4400;...
79.0000 62.0000 75.0000 93.0000 61.0000 1.4000;...
84.0000 78.0000 76.0000 73.0000 58.0000 1.3800;...
79.0000 87.0000 91.0000 77.0000 61.0000 1.9000;...
67.0000 44.0000 90.0000 75.0000 72.0000 0.9600];
assert(all(abs(rescale_scores(x) - y_correct) < 1e-3, 'all'))
|
386 Solvers
Relative ratio of "1" in binary number
392 Solvers
Rounding off numbers to n decimals
1050 Solvers
359 Solvers
326 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!