WindowKeyPressFcn not work if pressing key after using brush data
    3 次查看(过去 30 天)
  
       显示 更早的评论
    
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 个评论
回答(0 个)
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
