Clearing a Panel - AppDesigner
66 ビュー (過去 30 日間)
古いコメントを表示
Hi, I am creating an App that utilizes the add-on myaxisc, which creates figures with many y axis in a panel object. I am looking for a way to completely clear the panel, as I am replotting many times based on user input. Would really appreciate any help
Thanks,
Garrett
1 件のコメント
Jordan
2023 年 8 月 9 日
Can you share the code for using myaxisc in app designer? I just found this add-on and want to understand it a bit better.
Thanks!
採用された回答
Tanay Gupta
2021 年 7 月 13 日
In App Designer, objects share data with each other through properties. You can share these properties between various objects. Every time the user gives an input an event is generated. You can code how the graph changes when this happens by editing the callback section of that object (e.g. slider, input box, etc). Using these two tools you can change the output in any way you like. Please refer the documentation for more information.
For e.g. if you want to clear the plotted data when a button is pressed you can save the data as a property (e.g. as plotted_Data) while plotting and run the following commands.
Assuming you have a button. The layout will be something like this:
function ButtonPushed(app, event)
delete(plotted_Data)
end
Using the above command you can clear the plotted the data from the graph in the panel.
If you want to resize the axis then you can change the property of the UIAxes as follows:
%The range can be dynamic based on the input
function ButtonPushed(app, event)
app.UIAxes.XTick = [0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2];
end
To delete the axis you can use the command below:
function ButtonPushed(app, event)
delete(app.UIAxes);
end
You can recreate the axis like this
function ButtonPushed(app, event)
app.UIAxes = uiaxes(app.Panel);
title(app.UIAxes, 'Title')
xlabel(app.UIAxes, 'X')
ylabel(app.UIAxes, 'Y')
zlabel(app.UIAxes, 'Z')
app.UIAxes.XTick = [0 0.2 0.4 0.6 0.8 1];
app.UIAxes.XTickLabel = {'0'; '0.2'; '0.4'; '0.6'; '0.8'; '1'};
app.UIAxes.Position = [78 67 259 185];
end
0 件のコメント
その他の回答 (2 件)
Jonathan Wharrier
2024 年 1 月 26 日
There is a very simple way...
delete(app.panelName.children);
this will completely clear the panel of all objects attached to it.
0 件のコメント
长耕
2024 年 8 月 7 日 5:49
maybe its a bit too late but I faced the same problem and found the solution.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1748319/image.png)
you can click the "canvas" button and convert it to "no auto adjustable layout app", then you will be able to delete a panel.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!