MATLAB Answers

0

yyaxis not working in app designer.

David Levesque さんによって質問されました 2019 年 11 月 7 日
最新アクティビティ Adam Danz
さんによって 編集されました 2019 年 11 月 15 日 16:46
Hi, I'm trying to plot a line on both the left and right side of a UIAxes in App Designer with the command yyaxis(myAxes, 'left'). I stripped down the problem to its most simple expression, a single figure with a UIAxes in it.
yyaxis.png
When I click on the graph I get that error:
Warning: Error occurred while executing the listener callback for event WindowMousePress defined for class
matlab.ui.Figure:
Unrecognized method, property, or field 'processFigureHitObject' for class 'matlab.ui.control.UIAxes'.
Error in matlab.graphics.internal.YYAxisEventManager
Error in matlab.graphics.internal.YYAxisEventManager
The code in the startupFcn is:
yyaxis(app.UIAxes, 'left');
x = pi:0.1:3*pi;
y = sin(x);
plot(app.UIAxes,x,y);
I use Matlab R2019b.
Anyone got an idea?

  4 件のコメント

David Levesque 2019 年 11 月 8 日
Thanks for looking into it.
In 2019b your code gives me the same error. Matlab also becomes very unstable. I can't copy-paste into the file, I can't save the file. I usually have to reboot Matlab completely.
Adam Danz
2019 年 11 月 8 日
Tested in r2019b on my end and it threw the same warning (not an error). I didn't have more time to look into it.
The warning occurs when you click on an object within the UIAxis but not when you click on the axis background itself.
Adam Danz
2019 年 11 月 15 日 15:13
Mark Gerber 's answer moved here as a comment.
I am experiencing similar problems.

サインイン to comment.

1 件の回答

Adam Danz
回答者: Adam Danz
2019 年 11 月 15 日 16:16
編集済み: Adam Danz
2019 年 11 月 15 日 16:32
 採用された回答

The problem
A warning is thrown when clicking on UIAxis objects that were plotted with yyaxis. To recreate the problem:
% (in r2019b)
fh = uifigure();
uia = uiaxes(fh);
yyaxis(uia, 'left');
plot(uia,rand(1,5),'-o');
yyaxis(uia, 'right');
plot(uia,rand(1,5),'-o');
% Now, click on the x or y axes or any of the line objects
Temporary work-around
This has been reported to Tech Support (case #03884386) and hopefully will be addressed in future releases. If the warning is bothersome, you can suppress it (and any other warnings caused by a callback error) by executing this line of code before or immediately after the yyaxis plot is created.
% in app designer, this can go in your startupFcn
warning('off','MATLAB:callback:error')
to turn the warning back on (which you should do)
% in app designer, this can go in your UIFigureCloseRequest function
% otherwise, it should be a part of your figure's CloseRequestFcn
warning('on','MATLAB:callback:error')

  0 件のコメント

サインイン to comment.



Translated by