App designer - deleting an unnamed plot

7 ビュー (過去 30 日間)
Teshan Rezel
Teshan Rezel 2021 年 4 月 10 日
コメント済み: Cris LaPierre 2021 年 4 月 19 日
Hi folks,
I have the following code for generating 1 or multiple plots on an image.
function ROI(app, index1, index2)
hold (app.Image, "on")
plot(app.Image, index1, index2, app.innerMarkerStyle, 'LineWidth', app.CrosshairThickness.Value, 'Color', app.crossHairColour, 'MarkerSize', app.CrosshairRadius.Value);
plot(app.Image, index1, index2, app.outerMarkerStyle, 'LineWidth', app.CrosshairThickness.Value, 'Color', app.crossHairColour, 'MarkerSize', app.CrosshairRadius.Value);
end
My question is, suppose there are 3 such plots. Is there a way to delete 1 and only 1 of them selectively?
Thanks

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 4 月 10 日
If you capture the chart line object for each plot, you could use that with the delete function to remove just that line from the plot.
btw, it's best practice to always pair hold on with a corresponding hold off.
Here's a simple example.
% Create a plot with 3 lines
a=plot(rand(1,5));
hold on
b=plot(rand(1,5));
c=plot(rand(1,5));
hold off
% Now delete one of the lines using the line object
delete(b)
  16 件のコメント
Teshan Rezel
Teshan Rezel 2021 年 4 月 19 日
hi @Cris LaPierre, sorry about this...I was just being very stupid...well, more than usual! This has been a tremendous help, thank you!
Cris LaPierre
Cris LaPierre 2021 年 4 月 19 日
No need to apologize. This is no beginner app!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeographic Plots についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by