Appdesigner: KeyPressFcn in a while loop
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I recently saw that matworks implement KeyPressfcn in the app designer. I was trying to explore a bit and do a keystroke recognition program but unfortunately I tried something that I could not solve. First I just added a callback to KeyPressFcn. The idea is to hit any button and assign it to the base workspace.
function UIFigureKeyPress(app, event)
app.key = event.Key;
assignin('base','key1', app.key)
end
Extending the program, I tried to put this recognition inside the loop, so the recognition only occurs when the button is pushed.
function StartStopButtonValueChanged(app, event)
app.button = app.StartStopButton.Value;
while app.button == 1
assignin('base','key2', app.key)
pause(0.0001)
end
end
since the program gets stuck in the loop, I can not use the other function. Question is: how can I open the other function in parallel or call the other function inside the loop?
I've tried a lot of thins and even lost the north and the creativity trying to make it work. Could someone help me by giving me the light on how should I call the loop or how can I make the recognition work only when the button pushed?
I'm already grateful,
Sincerely
Martin
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!