How do I get MatLab to respond to keyboard?
12 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I would like to run some code if the letter "r" is pressed on the keyboard. How would I do this? And what syntax would be used? And should I store the code I would like to run in a separate editor?
Thank you!
1 Commento
Risposte (1)
Walter Roberson
il 19 Ott 2016
The methods are the same as for http://www.mathworks.com/matlabcentral/answers/307934-how-to-increase-a-value-with-the-arrow-keys#answer_239631
7 Commenti
Walter Roberson
il 21 Ott 2016
In the editor for callbackfunction.m change the code to be
function callbackfunction(src, event)
if strcmp(event.Character, 'r')
imshow('TheImageToDisplay.jpg');
end
Then in the code that needs to tell MATLAB to allow that callback to be used, put in
set(gcf, 'Windowkeypressfcn', @callbackfunction)
Vedere anche
Categorie
Scopri di più su Desktop in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!