Matlab for
iterates over values โโin a row vector. Just like your example if C_VALUES were a string.
for val = row_vec
- matlab syntax. val
will take the row_vec
values โโas it iterates. The syntax you'll often see (but not necessarily) is
for ii = 1:length(values) val = values(ii);
Here 1:length(values)
creates the string vector [1 2 3 ...]
, and ii
can be used for indexing in values
.
(Note: i
is another common choice, but as soon as you use i
in this type of context where it is assigned a value, you can no longer use it in an imaginary number).
source share