How do you allow the user to select a line in a GUI and change the color?

2 views (last 30 days)
I want to be able to have the user click a button then select the line to change the color.

Answers (1)

Cris LaPierre
Cris LaPierre on 24 Sep 2021
There is no built-in way to do this that I am aware of. However, your lines appear to be fairly horizontal.
Capture the handle when you plot the channels.
You could possibly use ginput to have the user click a point in the axes. You could take the y coordinate of that point and find the line whose mean y value is closest to that. Assuming you have a vector of mean values for each channel, you could determine the index of the channel. You could then use that index with the plot object captured previously to change the properties of that line.

Categories

Find more on Graphics Object Properties 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!