How to pause matlab a specific amount of time between iterations??

3 ビュー (過去 30 日間)
Ceren GURKAN
Ceren GURKAN 2013 年 1 月 31 日
Hello everyone,
I am using Matlab with a CFD solver. In my code there is this a for loop, and at the end of each iteration some job submitted to the solver. I want Matlab to wait till I get the solution files from the solver, and proceed to next iteration afterwards, with this newly created solution files. It takes more or less 3 hours to get the solution files so is there any way that I can pause Matlab for 3 hours between sucsessive iterations??
Any help would be appriciated. Thank you in advance.

採用された回答

Sean de Wolski
Sean de Wolski 2013 年 1 月 31 日
Yes, use a timer for this; not a while-loop!
What I would do is put a 'StartDelay' on the timer for say 2hrs and 45 minutes. Then check every 10s or whatever (The timer's 'Period'). Until the file is found or whatever else you are using to know when the CFD simulation is complete.
Then simply have the 'TimerFcn' stop the timer and the 'StopFcn' do whatever else you need to do.
  7 件のコメント
Sean de Wolski
Sean de Wolski 2013 年 1 月 31 日
But it kind of depends on how this intantiate the CFD suimulation. We're just guessing right now.
Ceren GURKAN
Ceren GURKAN 2013 年 2 月 1 日
Guys thank you for all these commands, I am sending the jobs to the CFD solver with say "qsub batchfile_case1" command as you guess. I will try the suggestions and update status here :) Any other commands would be appriciated though.

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

その他の回答 (2 件)

Jason Ross
Jason Ross 2013 年 2 月 1 日
If you have Parallel Computing Toolbox, you can set up an integration with your cluster (I'm guessing it's PBS Pro or Torque), and you could use the batch() command to submit your job. You can then check the state of the job as it progresses through the queued, executing and finished stages. It might work for your situation.
If you don't have PCT, setting up the timer to look for the files or exit condition would be a nice and clean approach.

Ryan G
Ryan G 2013 年 1 月 31 日
編集済み: Ryan G 2013 年 1 月 31 日
You could enter a while loop until you are able to retrieve the data.
You could also potentially use a timer object to test for solution files periodically and continue on once they are found.

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by