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 件のコメント

Roberto Garces
Roberto Garces 2021 年 2 月 8 日
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 件)

カテゴリ

質問済み:

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