Storing the values of a for loop

1 view (last 30 days)
Aishwarya Bangalore Kumar
Aishwarya Bangalore Kumar on 12 Feb 2018
Commented: Star Strider on 12 Feb 2018
That is the line to increment ze from 0.1 to 1.2 in increments of 0.1. How do I store the values of ze?
for ze=0.1:0.1:1.2 end;
  3 Comments
Stephen23
Stephen23 on 12 Feb 2018
@Aishwarya Bangalore Kumar: it creates a vector ze with values from 0.1 to 1.2 in steps of 0.1.

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 12 Feb 2018
Assign ‘ze’ before the loop, then index with reference to it:
ze = 0.1:0.1:1.2;
for k = 1:numel(ze)
v(k) = % DO SOMETHING
end
  8 Comments
Aishwarya Bangalore Kumar
Aishwarya Bangalore Kumar on 12 Feb 2018
Thank you I understood now , it was a big help!
Star Strider
Star Strider on 12 Feb 2018
As always, my pleasure!

Sign in to comment.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!