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

Réponses (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.

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Question posée :

NjZ
le 22 Nov 2018

Commenté :

NjZ
le 22 Nov 2018

Community Treasure Hunt

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

Start Hunting!

Translated by