フィルターのクリア

Using pause, but stop if user input

4 ビュー (過去 30 日間)
Pete
Pete 2018 年 1 月 16 日
コメント済み: Rik 2018 年 1 月 16 日
Another struggle: Looking to get/make a function that will pause while doing something (eg displaying figure), and if user wants to view it, they can. But after a period of time (if away from desk, for example), the pause will end and the next figure will be displayed. eg pause(5) but continue after 1 if user presses enter before the 5 are up?
I've thought about:
StartTime = clock;
while clock <= StartTime+delay_time
{PAUSE or wait for user input}
end
But can't think of how to use "input" as it must have uiwait built in. Is there a way to do this or is it just easier to accept that any delays are fixed or user has to move the code on?

採用された回答

Rik
Rik 2018 年 1 月 16 日
waitforbuttonpress may be of help here. You can also check this function: getkey (FEX).
  2 件のコメント
Pete
Pete 2018 年 1 月 16 日
getkeywait from file exchange is suggested within getkey and it looks to do what I'm after. Thanks :)
Rik
Rik 2018 年 1 月 16 日
You're welcome.
If you found this answer useful, please mark it as accepted answer. It will make it easier for other people with the same question to find an answer, as well as give me reputation points. If this didn't solve your question, please comment with what problems you are still having.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by