Error in solution: Line: 6 Column: 5 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

function X = rescale_scores(X)
Y = X(:,end)
[m,n] = size(X)
a = 1
B = []
for 1:m
if 60=< Y(a) < 70
B = [B;rescale(Y(a),0,1)]
a = a+1
elseif 70 =< Y(a) < 80
B = [B;rescale(Y(a),1,2)]
a = a+1
elseif 80 =< Y(a) < 90
B = [B;rescale(Y(a),2,3)]
a = a+1
elseif 90 =< Y(a) < 100
B = [B;rescale(Y(a),3,4)]
a = a+1
end
end
X = [X(:,end-1),B]
end

回答 (1 件)

Cris LaPierre
Cris LaPierre 2020 年 12 月 28 日
You must create a variable for your loop counter in your for loop. Look at some of the examples here.
For loop syntax is also covered in Ch 13 of MATLAB Onramp.

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

製品

回答済み:

2020 年 12 月 28 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by