d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Matalb Question > About Delays
12Next
Add Reply New Topic New Poll
Member
Posts: 16,909
Joined: Aug 14 2009
Gold: 0.00
Mar 21 2014 02:37pm
is there a normal delay function that just interrupt the script like pause(); does
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Mar 21 2014 05:25pm
Quote (zell1luk @ Mar 21 2014 03:37pm)
is there a normal delay function that just interrupt the script like pause(); does


http://www.mathworks.com/help/matlab/ref/pause.html
Member
Posts: 16,909
Joined: Aug 14 2009
Gold: 0.00
Mar 21 2014 05:29pm
that stops the script from running for the duration, we already tried that and it doesn't work.
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Mar 21 2014 06:06pm
Quote (zell1luk @ Mar 21 2014 04:29pm)
that stops the script from running for the duration
I'm confused. Isn't that what you asked for?

Member
Posts: 16,909
Joined: Aug 14 2009
Gold: 0.00
Mar 21 2014 06:10pm
Quote (Azrad @ Mar 21 2014 07:06pm)
I'm confused. Isn't that what you asked for?


no, im trying to setup a program to play an sos message but can be instantly stopped between beeps
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Mar 21 2014 06:42pm
I've never used matlab but just read some of its commands and stuff. The one that caught my attention was:

if get(f,'currentkey') == 'a'

maybe you could put that in your loop to tell if a key has been pressed
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Mar 21 2014 06:56pm
Quote (zell1luk @ Mar 21 2014 07:10pm)
no, im trying to setup a program to play an sos message but can be instantly stopped between beeps


What does that mean? You are saying you want some sound to be playing and then if you press a key or something it will pause the program mid beep and then if you press another key it will resume where it left off??
Member
Posts: 16,909
Joined: Aug 14 2009
Gold: 0.00
Mar 21 2014 06:59pm
Quote (Minkomonster @ Mar 21 2014 07:56pm)
What does that mean? You are saying you want some sound to be playing and then if you press a key or something it will pause the program mid beep and then if you press another key it will resume where it left off??

almost, just stop completely when i hit a button tho
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Mar 21 2014 07:05pm
Quote (zell1luk @ Mar 21 2014 07:59pm)
almost, just stop completely when i hit a button tho


http://www.mathworks.com/help/matlab/ref/exit.html

use that along with what Azrad suggested.
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Mar 21 2014 07:48pm
i would do something like this
Code
last_letter_pressed = get last letter pressed
while True:
play sounds
current_letter_pressed = get last latter pressed
if current_letter_pressed != last_letter_pressed:
exit


might be a pitfall in that I got no idea what "get last letter pressed" returns when you first start the program
Go Back To Programming & Development Topic List
12Next
Add Reply New Topic New Poll