Appdesigner: KeyPressFcn in a while loop

조회 수: 2 (최근 30일)
MSP
MSP 2019년 5월 29일
편집: MSP 2019년 5월 29일
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개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by