Matlab for loop that manipulates a list? -



Matlab for loop that manipulates a list? -

i new matlab apologize relatively easy questions.

i have:

for i=0:10 values(:,1) = (2.*i-20)*5.; end

i want script produce vector of 11 values have been changed (2.*i-20)*5. each i.

i think meant this:

for i=0:10 values(i+1,1) = (2.*i-20)*5.; %you can write -> values(i) end

more general way fill array in for loop when loop variable doesn't go 1 desired value:

count=0; i=0:10 count=count+1; values(count,1) = (2.*i-20)*5.; end

but wait, not @ way of programming in matlab. should such operations follows:

i=0:10; values=(2.*i-20)*5.;

the above solution called vectorized solution.

matlab loops for-loop vectorization

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -