graphics in R2015b ...

4 views (last 30 days)
Oliver Chikumbo
Oliver Chikumbo on 10 Oct 2015
Commented: Oliver Chikumbo on 10 Oct 2015
I have Matlab GUI code that runs perfectly under R2014a and since upgrading to R2015b I'm having some teething problems to get it run.
The problem is in the cursormode oncallback function where a subfunction is suppose give me the xy coordinates and index of the xy coordinates in a window. Since I have two figures open for reason the I use Tag to find the axes object, it cannot see it because it remains locked to the figure (lets call that A) that I'm not working on. There I see no results and there isn't any errors reported either.
This is the start of the code:
function Andy2Dcursormode_OnCallback(hObject, eventdata, handles)
% hObject handle to Andy2Dcursormode (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
dcm_obj = datacursormode;
set(dcm_obj,'UpdateFcn',@myfunction,'DisplayStyle','window');
%
function output_txt = myfunction(obj, event_obj)
% Display the position of the data cursor
% obj Currently not used (empty)
% event_obj Handle to event object
pos = event_obj.Position;
set(event_obj.Target,'LineStyle','--','LineWidth',2, 'Color',[0.3 0.8 0]); % Make selected line wider and avocado
h1 = findobj('Tag','andyplot2D');
data = get(h1,'UserData');...
So h1 is never found. On R2014a, there is no such problems and it runs perfectly. Figure A also has the same exact code for cursormode for its plots and that also works well under R2015b. What else do I need to specify under R2015b so that my code can start running like it should?

Accepted Answer

Walter Roberson
Walter Roberson on 10 Oct 2015
Try findall instead of findobj. The handle visibility might be set to 'off' or 'callback'
  1 Comment
Oliver Chikumbo
Oliver Chikumbo on 10 Oct 2015
spot on ...the HandleVisibility was set on "callback" instead of "on". Thanks a bunch Walter ...you are a champion!

Sign in to comment.

More Answers (0)

Categories

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