MATLAB Answers

0

timeout on input prompt

Asked by Azura Hashim on 18 Aug 2018
Latest activity Answered by Jan
on 20 Aug 2018
Accepted Answer by Jan
Hi,
I need to implement a timeout on an input prompt. I have found similar questions but all the answers implement a dialog box. Can someone point out how to implement the timeout on a plain command line input prompt? Thanks.

  2 Comments

dpb
on 18 Aug 2018
timeout functions only for an instrument object; has nothing to do with user input/output...

Sign in to comment.

1 Answer

Jan
Answer by Jan
on 20 Aug 2018
 Accepted Answer

You can try to use a timer and FEX: inputemu to emulate the pressing of the Return key after a certain delay. This needs some tricks to distinguish it from regular hit of Return e.g. if the user tried to input "1.23" but the timeout sends the key after "1.2" already.
I would certainly stay away from such tricks. Such magic behavior can be very annoying, when it disturbs the user input. The command window is not the right location for such smart tricks.

  0 Comments

Sign in to comment.