- Technical Services and Consulting
- Embedded Systems | Firmware Developement | Simulations
- Electrical and Electronics Engineering
How to update rfplots
13 ビュー (過去 30 日間)
古いコメントを表示
I'm using the rfplot command from the RF Toolbox create a s-parameter visualization GUI. (App Designer)
"hold on" is used to plot several parameters in one figrue.
On some points, the plots have to be updated. For instance, if the user wants to delete a parameter.
The problem is how to reset these plots?
hold(app.AxesMag, 'on');
rfplot(app.AxesMag,app.s2p1,{[app.n(1),app.n(2)]});
rfplot(app.AxesMag,app.s2p2,{[app.n(1),app.n(2)]});
hold(app.AxesMag, 'off');
This works fine, but if the plots are to be updated, they will be added to the old ones. My question is how to reset the figure? Resetting/Clearing the Axes via "clf" or "cla" does not work.
0 件のコメント
回答 (2 件)
Hassaan
2024 年 1 月 24 日
% Clear the axes
cla(app.AxesMag);
% Hold on for multiple plots
hold(app.AxesMag, 'on');
% Plot your s-parameters
rfplot(app.AxesMag, app.s2p1, {[app.n(1), app.n(2)]});
rfplot(app.AxesMag, app.s2p2, {[app.n(1), app.n(2)]});
% Release hold
hold(app.AxesMag, 'off');
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
Feel free to contact me.
2 件のコメント
Adam Danz
2024 年 1 月 25 日
> Resetting/Clearing the Axes via "clf" or "cla" does not work
This answer is not helpful. Your answer just copies the same code from the question and then uses cla which the OP claims isn't working.
@Muhammad Hassaan Shah please review the Generative AI guidelines for MATLAB Central
The use of generative AI tools is allowed but you are responsible for ensuring that your content is relevant and accurate.
Adam Danz
2024 年 1 月 24 日
I'm not quite sure how to interpret the problem. Here are two guesses.
> if the plots are to be updated, they will be added to the old ones
If you are trying to add more lines to the existing axes, use hold(app.AxesMag,'on') or remove the hold(app.AxesMag,'off').
If you are trying to update the line objects, add an output to the rfplot function. The output is a handle array of line handles. The line handles contain XData and YData properties that can be updated.
> My question is how to reset the figure? Resetting/Clearing the Axes via "clf" or "cla" does not work.
If the goal is the clear the axes, cla does work and if the goal is to clear the figure, clf does work so I would need more details on what's not working.
4 件のコメント
Hassaan
2024 年 1 月 26 日
編集済み: Hassaan
2024 年 1 月 26 日
Reference
> Resetting/Clearing the Axes via "clf" or "cla" does not work
Any answer/solution provided that does not solves OP query is 'Generative AI' I dont know how.
As per OP:
'Unfortunately your suggestion doesn't work as well.'
This answer is not helpful. Your answer just copies the same code from the question/comments with slight argument change and then uses cla which the OP claims isn't working.
AI Guidelines:
I hope other senior members of MATLAB community can shed some light on this. And better define 'Do's and Don't' for 'Generative AI' usage and defination for the MATLAB QnA community. Instead, of marking and assumming every other answer as 'Generative AI'.
参考
カテゴリ
Help Center および File Exchange で Visualization and Data Export についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!