graphics in R2015b ...

11 ビュー (過去 30 日間)
Oliver Chikumbo
Oliver Chikumbo 2015 年 10 月 10 日
コメント済み: Oliver Chikumbo 2015 年 10 月 10 日
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?

採用された回答

Walter Roberson
Walter Roberson 2015 年 10 月 10 日
Try findall instead of findobj. The handle visibility might be set to 'off' or 'callback'
  1 件のコメント
Oliver Chikumbo
Oliver Chikumbo 2015 年 10 月 10 日
spot on ...the HandleVisibility was set on "callback" instead of "on". Thanks a bunch Walter ...you are a champion!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by