How to run through many variables at a different set of times continuously?

1 回表示 (過去 30 日間)
Nikolaos Zafirakis
Nikolaos Zafirakis 2019 年 6 月 16 日
コメント済み: Stephen23 2019 年 6 月 17 日
There are 200 O's and each O lasts 100 minutes, so I need to run the simulation for t=20000 minutes and then every 100 minutes I need the simulation to jump to the next O. I'm really stuck on this and can’t figure out a way around it does anyone have any suggestions to how I can achieve this?
ID = '0000'; % text document
t = 1:100; % time in minutes!
O = 1; % There are 200 O's
[x, y , z] = pst(ID,t,text_document);
  2 件のコメント
Walter Roberson
Walter Roberson 2019 年 6 月 16 日
O_idx = floor((t-1)/100)+1;
Nikolaos Zafirakis
Nikolaos Zafirakis 2019 年 6 月 16 日
This won’t specifically achieve what I need as it will give me 100 set of 1 and then 100-200 set of 2 then 200-300 sets of 3 ...... I specifically need the script to stick at 1 for 100 seconds. In other words I need only one 1 for 1-100 and then only one 2 for 100-200 .....

サインインしてコメントする。

回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2019 年 6 月 16 日
Probably, you can employ for loop (ii = 1:200) then combine/concatenate all evaloved values into separate variable(s).
e.g.
ID = '0000'; % text document
for ii=1:200
t = 1:100;
Os = O(ii);
[x(ii,:), y(ii,:) , z(ii,:)] = pst(ID,t,text_document);
end
...

カテゴリ

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