graphics in R2015b ...

9 Ansichten (letzte 30 Tage)
Oliver Chikumbo
Oliver Chikumbo am 10 Okt. 2015
Kommentiert: Oliver Chikumbo am 10 Okt. 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?

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by