pause with time and keyboard

3 ビュー (過去 30 日間)
Marco Castelli
Marco Castelli 2015 年 1 月 9 日
コメント済み: Marco Castelli 2015 年 1 月 10 日
I have put the pause function in my code. After pause I would like to restart the script after some time (i.e. 10 seconds) or by press on the keyboard. Do you know how can I do?
Marco
  2 件のコメント
Titus Edelhofer
Titus Edelhofer 2015 年 1 月 9 日
Hi Marco,
could you give some more details? I'm not sure what you want to achieve ...
Titus
Marco Castelli
Marco Castelli 2015 年 1 月 10 日
I have a code. At a certain row I want that run stops and will resume only after 10 seconds or if I press some letter on the keyboard. I was locking a solution with pause() function but other answers can be valid.

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

回答 (1 件)

Amos
Amos 2015 年 1 月 9 日
Maybe you can start a parfor loop with two parallel tasks, and run a while loop in each of them - the first while loop checks for the time and writes a flag into a text file when 10s are over and the second while loop checks for input before it writes a flag into the same text file. Both while loops halt when the flag is set in the text file ...
Yes this is very ugly and I don't know if it works.
  1 件のコメント
Marco Castelli
Marco Castelli 2015 年 1 月 10 日
Thank you It is quite tricky to write the code but is a smart way to use parfor. I'll try to follow your answer but I'm not sure it works.

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

カテゴリ

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