Delete only one smithplot line
Ältere Kommentare anzeigen
Hi all,
I'm trying to adapt to the new version of Matlab, so I'm sorry that this is my third question regarding Smith charts.
But this behavior of Matlab / App Designer makes literally no sense to me.
For comparison, I created two programs.
The first program uses the normal plot function to plot two graphs on one Axes, and the second one uses the Smith plot function to plot the S11 parameter of two different dipole antennas on one smith chart.
The first one that works is structured as follows:
It shares the later used h1 and h2 handles with the app.
properties (Access = private)
h1
h2
end
and has two functions: one that runs on startup and one if you press the button.
% Code that executes after component creation
function startupFcn(app)
x = linspace(0,1,50);
app.h1 = plot(app.UIAxes,x,(x).^2);
hold(app.UIAxes,"on");
app.h2 = plot(app.UIAxes,x,(2*x).^2);
end
% Button pushed function: Button
function ButtonPushed(app, event)
delete(app.h2); % this works :)
end
The second Programm that dont work:
properties (Access = private)
s1 % sparameters of normal dipol
s2 % sparameters of dipol with lengh 4
hg1 % handle plot with normal dipol
hg2 % hadnle plot with dipol of lengh 4
end
% Code that executes after component creation
function startupFcn(app)
d1 = dipole;
d2 = dipole("Length",4);
freq = linspace(60e6,90e6,200);
app.s1 = sparameters(d1,freq);
app.s2 = sparameters(d2,freq);
app.hg1 = smithplot(app.s1,'Parent',app.UIAxes);
hold(app.UIAxes,"on");
app.hg2 = smithplot(app.s2,'Parent',app.UIAxes);
end
% Callback function: Button, Slider
function ButtonPushed(app, event)
delete(app.hg2) % This deletes the complete Smith chart :(
end
As written in the comments the second one deletes the whole smith chart all together.
So my question is how can i only remove the second plot (app.hg2) ?
Thanks for your time :)
I attached the two files if you want to compare the behavior of these two programs.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Visualization and Data Export finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

