How can I evaluate a script using a WindowKeyPressFcn?
7 views (last 30 days)
Show older comments
Joseph O'Keefe
on 14 Aug 2015
Commented: Walter Roberson
on 15 Aug 2015
MATLAB experts,
I'm using GUIDE to generate a GUI that has 5 push buttons, each of which runs a script upon being pressed. I'd also like to bind a key to each of those scripts. It seems like WindowKeyPressFcn is what I'm looking to use, but I'm not sure how to use that to make a key either press the push button or just run the script (either will work perfectly well!).
If this is a redundant question, please direct me somewhere where this has been answered, most threads I've already seen have rather complicated explanations.
Thanks in advance.
0 Comments
Accepted Answer
Walter Roberson
on 14 Aug 2015
Create a single WindowKeyPressFcn callback for your figure, and have it check which key was pressed. There is an example at http://uk.mathworks.com/matlabcentral/answers/210241#answer_175778
2 Comments
Walter Roberson
on 15 Aug 2015
Please show the line in which you set the WindowKeyPressFcn callback. Also please use the Property Inspector on the figure and see what is configured for WindowKeyPressFcn and show what it is (it might be a string)
More Answers (0)
See Also
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!