Hello friends, I hope you can help me with my code problem. I'm trying plot the impedance chart into an axes in a GUI, like this:
axes(handles.axes2);
impedance(di,linspace(50e6,f*10^6,51));
legend('Resistencia','Reactancia');
title('Impedancia');
ylabel('Impedancia (ohms)');
grid;
But the chart plots using all the window GUI figure. How can I plots the inpedance chart into the axes2?
Thanks in advance for your replies.

 채택된 답변

Adam Danz
Adam Danz 2021년 2월 6일
편집: Adam Danz 2021년 2월 9일

0 개 추천

I have a feeling you're working with a uifgure instead of the regular figures.
HandleVisibility of uifigures needs to be on to plot on current axes within the uifigure.
uif = uifigure();
% ax = axes(uif);
ax = uiaxes(uif);
set(0,'CurrentFigure',fig)
uif.CurrentAxes = ax;
uif.HandleVisibility = 'on';
impedance(di,linspace(50e6,f*10^6,51));
uif.HandleVisibility = 'off';
legend(ax, 'Resistencia','Reactancia');
title(ax, 'Impedancia');
ylabel(ax, 'Impedancia (ohms)');
grid(ax, 'on')

댓글 수: 4

Hello Adam Danz, thanks for your reply, you are so kind. I tried your code but I have an error:
Error using axes
Functionality not supported with figures created with the uifigure function.
What it means? Thanks in advace.
Adam Danz
Adam Danz 2021년 2월 8일
What release of Matlab are you using?
Roberto Garces
Roberto Garces 2021년 2월 8일
R2018a
Adam Danz
Adam Danz 2021년 2월 8일
편집: Adam Danz 2021년 2월 8일
That information is important to include in your question.
Replace this line
ax = axes(uif)
With this one
ax = uiaxes(uif)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Axis Labels에 대해 자세히 알아보기

질문:

2021년 2월 6일

편집:

2021년 2월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by