WindowKeyPressFcn not work if pressing key after using brush data

조회 수: 3 (최근 30일)
Alba Solb
Alba Solb 2019년 2월 21일
Hi everyone,
I have multiple figure that I use to brush data or sometimes to change color to all dots from the figures, and it plots new data everytime I press 'space'. But sometimes I use the brush tool to select data and then press a key like 'r' to mark the selection in all the corresponding dots from all the figures in red. With Matlab version 2013 it worked find, but it does not with newer versions.
Before I had pause, and worked fine, and now I am trying to go around using the waitfor instead by looking at 'UserData' keys.
I run the code:
set(gcf,'WindowKeyPressFcn', @myKeyPress)
currentFig = gcf;
waitfor(currentFig,'UserData')
cc = get(currentFig,'UserData');
------
function myKeyPress(hFig, EventData)
set(hFig, 'UserData', EventData.Key)
end
It works fine if I press different keys, but if I use the brush tool and then press the key it does not work anymore. It does for one figure if I use brush on/off when pressing a key, like:
if strcmp(cc,'p')
brush on
currentFig = gcf;
waitfor(currentFig,'CurrentCharacter')
cc = get(gcf,'CurrentCharacter');
brush off
end
However, this does not work if I active the brush in another figure, if I press the key 'p' in another figure.
I will appreciate any comment

답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by