From: Walter Roberson on 27 May 2010 23:09 Bryan wrote: > "Bryan " <bryancasares(a)hotmail.com> wrote in message > <htkgng$4n6$1(a)fred.mathworks.com>... >> I want matlab to perform certain action if the user does nos insert a >> value for a variable after certain time? Is there any way to do that? > Thank you very much for your answer, but I still have a problem. > The last line executed in my program would be > a=input('Insert value') > I want the program to asign 0 to the variable "a" if the user does not > insert a value after 60 seconds. The problem is that I cannot find a way > to stop executing "input" I suggest that you copy inputdlg.m to a new file, edit the function name to the new name, and search down in there for uiwait() and use the two-argument form of uiwait() to put a limit on the time waited. You may also need to add a couple of lines to set the values to 0 in the case the timeout is detected. You can tell that the timeout was hit because if the timeout was hit then the handle being waited on is still a valid handle for ishandle() and if the user responded instead of timing out then ishandle() on that handle will be false.
From: Daniel on 28 May 2010 05:13 Walter Roberson <roberson(a)hushmail.com> wrote in message <XtGLn.40815$wV.27661(a)newsfe11.iad>... > I suggest that you copy inputdlg.m to a new file, edit the function name > to the new name, and search down in there for uiwait() and use the > two-argument form of uiwait() to put a limit on the time waited. You may > also need to add a couple of lines to set the values to 0 in the case > the timeout is detected. You can tell that the timeout was hit because > if the timeout was hit then the handle being waited on is still a valid > handle for ishandle() and if the user responded instead of timing out > then ishandle() on that handle will be false. I have always wondered to what extent the Matlab EUL allows for this.
First
|
Prev
|
Pages: 1 2 Prev: Remove certain spaces of a char matrix Next: How to reference Matlab Help? |