Matlab Opens smithplot in new figure

Hi all,
I want to design an Application with the new App Designer that uses a smith chart. But when I would like to plot the smith chart on the already Defined UI.Axes Object, but when I try to plot it, it opens in a new Figure. I already tried to use the axes command, but it doesn't help. How can I fix this behavior
Thank you very much
d = dipole;
freq = linspace(60e6,90e6,200);
s = sparameters(d,freq);
axes(app.UIAxes)
hg = smithplot(s);

 採用された回答

Kevin Holly
Kevin Holly 2023 年 7 月 28 日

1 投票

For the smithplot function, you need to change the Parent to the app.UIAxes
d = dipole;
freq = linspace(60e6,90e6,200);
s = sparameters(d,freq);
hg = smithplot(s,'Parent',app.UIAxes);

その他の回答 (1 件)

dpb
dpb 2023 年 7 月 28 日
編集済み: dpb 2023 年 7 月 28 日

0 投票

d = dipole;
freq = linspace(60e6,90e6,200);
s = sparameters(d,freq);
Error using matlab.internal.lang.capability.Capability.require
Support for Java user interfaces is required, which is not available on this platform.

Error in waitbar (line 46)
Capability.require(Capability.Swing);

Error in em.EmStructures/analyze

Error in em.PortAnalysis/impedance (line 164)
status = analyze(obj,freq);

Error in em.SharedPortAnalysis/protectedsparameters (line 98)
Z = impedance(obj,freq);

Error in em.PortAnalysis/sparameters (line 43)
S = protectedsparameters(obj,freq,z0);
hUIF=uifigure; % make a uifigure, not figure
app.UIAxes=axes(hUIF); % put the axes inside it; is regular figure axes otherwise
hg = smithplot(app.UIAxes,s); % put the plot in this axes; otherwise it defaults to plain
Well, can't do that in the available environment, but the key is you have to tell it to use your app axes; by default everything goes to the command window graphics environment; just because the code is in the app, that doesn't change that behavior, the plotting functions aren't aware of that context. Whether they could be made to be so, I don't; interesting Q? for possible enhancement, maybe???

2 件のコメント

Les Beckham
Les Beckham 2023 年 7 月 28 日
I believe that "uaxes" should be "uiaxes" in the next to last line of your code example.
dpb
dpb 2023 年 7 月 28 日
It died on something in the instrumentation toolbox stuff before it got there so didn't notice.
It is a typo, indeed, but I intended it to be just axes() with the uifigure as parent; that's what I've always done; I see that uiaxes() will create the uifigure so that's better way to go...thanks.

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

カテゴリ

ヘルプ センター および File ExchangeVisualization and Data Export についてさらに検索

製品

リリース

R2022b

質問済み:

2023 年 7 月 28 日

コメント済み:

dpb
2023 年 7 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by