update UIAxes when change values in a table in app Designer

17 views (last 30 days)
hi,
i have a UITable, UIAxes and a button. My program plots a wing giving some data from the table. I want to update the plot when i change the values in the table and press the button. I tried to set the UIAxes property: next plot---->replace children and replace all, but it doesn't work, the program add the new plot to the older. How can i delete the older plot? This is a piece of the code
function ButtonPushed(app, event)
%take data from the table
app.geo.c=str2double(app.UITable_wing.Data(1,6));
app.geo.dihed=str2double(app.UITable_wing.Data(1,9))*(pi/180);
app.geo.b=str2double(app.UITable_wing.Data(1,11));
app.g = ....
app.ref =....
%plot
geometryplot1(app.g,app.geo,app.ref,app.UIAxes)
end
how can i fix the problem?
Thank you!
  4 Comments
J. Alex Lee
J. Alex Lee on 1 Apr 2021
can you just call "cla(axHandle)" inside your geometryplot1 function?
My choice would be to have a plot initializer if the "things" you plot is always the same, and in your plot updater just update the data associated with each plot handle.
Maybe an even better way with more modern matlab would be to use the custom charts mechanism

Sign in to comment.

Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!