swcarpentry / matlab-novice-inflammation

Programming with MATLAB
http://swcarpentry.github.io/matlab-novice-inflammation/
Other
32 stars 66 forks source link

Ep 5: poorly motivated example #202

Closed gcapes closed 3 years ago

gcapes commented 5 years ago

This is the second example of a loop which is given.

LOOP_DEMO   Demo script to explain loops

len = 0
for vowel = 'aeiou'
    len = len + 1;
end

disp(['Number of vowels: ', num2str(len)])

It's not very realistic because you'd be better just using the length() function.

A better example might be to calculate a series like the fibonacci which isn't easy to vectorise

gcapes commented 5 years ago

Note that the debugging gif will need re-doing if this example is changed.

gcapes commented 3 years ago

Fixed in #232