WindowKeyPressFcn not work if pressing key after using brush data

2 views (last 30 days)
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

Answers (0)

Categories

Find more on Graphics Objects 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!