how delete xline in app designer

4 ビュー (過去 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!