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.

 Réponse acceptée

Adam Danz
Adam Danz le 6 Fév 2021
Modifié(e) : Adam Danz le 9 Fév 2021
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 commentaires

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 le 8 Fév 2021
What release of Matlab are you using?
Roberto Garces
Roberto Garces le 8 Fév 2021
R2018a
Adam Danz
Adam Danz le 8 Fév 2021
Modifié(e) : Adam Danz le 8 Fév 2021
That information is important to include in your question.
Replace this line
ax = axes(uif)
With this one
ax = uiaxes(uif)

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by