i have a little problem. I was able to code a "Next button" using app designer that have as aim to draw lines. I had the data coming from excel. I am able to draw each line by clicking on the next button. The only problem is that the previous data/line is not deleted. So instead of having one line, i will have 2 or more depending on how many times i click on the next button.
To illustrate it more, you can see the attached document. I am expecting to have just one LINE/BAND
the Next button code is below
uiconfirm(app.UIFigure,'Are You sure?','Confirm Close',...
app.exp_counter = app.exp_counter + 1;
v_or_h = app.v_or_h_array(app.exp_counter);
app.v_thick1 = app.v_thickness_1(app.exp_counter);
app.v_thick2 = app.v_thickness_2(app.exp_counter);
app.h_thick1 = app.h_thickness_1(app.exp_counter);
app.h_thick2 = app.h_thickness_2(app.exp_counter);
app.region1 = patch(app.UIAxes, ...
[app.v_thick1 app.v_thick2 app.v_thick2 app.v_thick1], ...
app.region1 = patch(app.UIAxes,[-10 10 10 -10], ...
[app.h_thick1 app.h_thick1 app.h_thick2 app.h_thick2], ...