I've been told that I should avoid "for" loops in MatLab because they are generally less efficient. True? Is there a better way to write this?
for y=1:33
VKT_SC(y,:)=SC_Share(y,:).*Total_F_VKT(y)
end

 Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 18 Jan. 2014
Bearbeitet: Azzi Abdelmalek am 18 Jan. 2014

0 Stimmen

VKT_SC=bsxfun(@times,SC_Share,Total_F_VKT)
or depending on the size of Total_F_VKT
VKT_SC=bsxfun(@times,SC_Share,Total_F_VKT')

Weitere Antworten (0)

Kategorien

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

Tags

Gefragt:

am 18 Jan. 2014

Kommentiert:

am 18 Jan. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by