How to run through many variables at a different set of times continuously?
    조회 수: 4 (최근 30일)
  
       이전 댓글 표시
    
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
답변 (1개)
  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
...
댓글 수: 1
  Stephen23
      
      
 2019년 6월 17일
				Remember to preallocate the output arrays before the loop:
참고 항목
카테고리
				Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



