Storing the values of a for loop

조회 수: 2 (최근 30일)
Aishwarya Bangalore Kumar
Aishwarya Bangalore Kumar 2018년 2월 12일
댓글: Star Strider 2018년 2월 12일
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
Aishwarya Bangalore Kumar
Aishwarya Bangalore Kumar 2018년 2월 12일
can you elaborate a little?
Stephen23
Stephen23 2018년 2월 12일
@Aishwarya Bangalore Kumar: it creates a vector ze with values from 0.1 to 1.2 in steps of 0.1.

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
Star Strider 2018년 2월 12일
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
Aishwarya Bangalore Kumar
Aishwarya Bangalore Kumar 2018년 2월 12일
Thank you I understood now , it was a big help!
Star Strider
Star Strider 2018년 2월 12일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by