how delete xline in app designer

3 次查看(过去 30 天)
Luca Re
Luca Re 2023-10-5
评论: Luca Re 2023-10-9
function RilevaPeriodoButtonValueChanged(app, event)
value = app.RilevaPeriodoButton.Value;
if value
A=app.Eq.Live.idxBackTestInizio;
B=app.Eq.Live.idxBackTestFine;
TRIL=app.Eq.RP_bin(A:B);
% disp(find(TRIL))
xline(app.UIAxes_Eq_2,find(TRIL),'HandleVisibility','off')
else
%%DELETE IT! HOW??
end

回答(1 个)

Jinal
Jinal 2023-10-9
编辑:Jinal 2023-10-9
Hello Luca,
As per my understanding, you would like to know how to delete a ‘ConstantLine’ created using ‘xline’ function in App Designer.
The ‘delete’ function can be used to delete a graphic object such as a ‘ConstantLine’.
Refer to the following sample code for creating and deleting a constant vertical line by changing the state of a ‘StateButton’ in App Designer:
properties (Access = private)
x1 = [];
end
% Callbacks that handle component events
methods (Access = private)
% Value changed function: Button
function ButtonValueChanged(app, event)
value = app.Button.Value
if value
app.x1 = xline(app.UIAxes,0.2,'HandleVisibility','off');
else
if(isprop(app,'x1'))
delete(app.x1);
end
end
end
end
Please refer to the following documentation to know about deleting graphic objects using the ‘delete’ function:
I hope this resolves the issue you were facing.
  1 个评论
Luca Re
Luca Re 2023-10-9
hi, I already tried that solution but it doesn't work..
disp(isprop(app,'x1'))
if(isprop(app,'x1'))
delete(app.x1);
end
end
>> 0

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!