How can i loop through certain columns in matrix, for example, 3th, 5th, 6th and 7th column?

Antworten (1)

Try using
for k = [3 5 6 7]
M = fitlm(trening(:,[2 4 k]),trening(:,1),'linear');
e3(k) = M.SSE;
end
Though be aware that you will be updating the same columns (3,5,6,7) in e3 when you may be wanting to update the first four columns.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Gefragt:

NjZ
am 22 Nov. 2018

Kommentiert:

NjZ
am 22 Nov. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by