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 Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by