Passing 'figure_handle' to 'datacusormode' in user-created class.
3 次查看(过去 30 天)
显示 更早的评论
I have a custom-class that I am using with a GUIDE-generated GUI. I want to create custom data-cursors. However, when I try to pass the axes-object to 'datacursormode(figure_handle)', I get the error 'Invalid figure handle'. My constructor is attached below. Any help is appreciated.
% Constructor
function obj = annotatorGUIClass(rawAxes, psdAxes, allAxes, parentFigure)
obj.rawDataDisplayAxes = rawAxes;
obj.psdDataDisplayAxes = psdAxes;
obj.allPairDisplayAxes = allAxes;
obj.dcmRaw = datacursormode(rawAxes);
obj.dcmPSD = datacursormode(psdAxes);
obj.rawDataDisplayAxes.NextPlot = 'replacechildren';
obj.psdDataDisplayAxes.NextPlot = 'replacechildren';
obj.allPairDisplayAxes.NextPlot = 'replacechildren';
obj.viewMode = 'Raw';
parentFigure.Renderer = 'painters';
end
0 个评论
采纳的回答
Steven Lord
2015-7-27
If you want to change the behavior/format based on the axes containing the object on which you clicked, I would use ANCESTOR in the UpdateFcn to find the axes containing the object whose handle is the UpdateFcn's Target input argument and use that to determine which behavior/format to use.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Visual Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!