From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Check keyboard without stopping?
Date: Wed, 24 Apr 2013 07:02:09 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 8
Message-ID: <kl801h$oec$>
References: <kl78up$nm1$>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1366786929 25036 (24 Apr 2013 07:02:09 GMT)
NNTP-Posting-Date: Wed, 24 Apr 2013 07:02:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: comp.soft-sys.matlab:794210

"Chuck37" wrote in message <kl78up$nm1$>...
> I have a huge simulation that takes a long time to run, so I watch in real time.  I'd like a way to get into debug mode when needed, but not have to press continue every iteration.  I was hoping to be able to poll the keyboard at each iteration to see if a key is pressed.  If so, I could go into a dummy section of code (e.g. pause(0)) and have a breakpoint there so I could examine variables, etc.  If a key wasn't pressed I could sit back and watch the simulation until something unusual happened.
> Is it possible?  Or maybe there's a feature of the debugger that does this some other way?

You can do within a figure/gui by using KeyPressFcn callback (and mouse button and so on). I never figure out how to do in command line.