Return of handle, which was selected with ‘ButtonDownFcn’
Hey there,
I plotted some data in just one figure, after that, I want to select some plots by mouse in the figure and I want to highlight it by increasing the ‘LineWidth’ and get the information, which of the plotted object has been selected.
In my main script, I use the following code to call the function (dxf.handle contains all the handles, which have been plotted before):
selected_entities = sub_select(dxf.handle);
The function has the following code:
function selected_object = sub_select(H)
set(H, ‘ButtonDownFcn’, selected_object = @LineSelected)
end
function ObjectH = LineSelected(ObjectH, EventData)
set(ObjectH, ‘LineWidth’, 2.5);
end
In general the code works and it’s possible to highlight the objects, but I didn’t get the information, which handle was selected. This information should be stored in selected_entities. At the moment, I just get this:
selected_object = @LineSelected
Thanks in advance for your help.
Best regards
DanielHey there,
I plotted some data in just one figure, after that, I want to select some plots by mouse in the figure and I want to highlight it by increasing the ‘LineWidth’ and get the information, which of the plotted object has been selected.
In my main script, I use the following code to call the function (dxf.handle contains all the handles, which have been plotted before):
selected_entities = sub_select(dxf.handle);
The function has the following code:
function selected_object = sub_select(H)
set(H, ‘ButtonDownFcn’, selected_object = @LineSelected)
end
function ObjectH = LineSelected(ObjectH, EventData)
set(ObjectH, ‘LineWidth’, 2.5);
end
In general the code works and it’s possible to highlight the objects, but I didn’t get the information, which handle was selected. This information should be stored in selected_entities. At the moment, I just get this:
selected_object = @LineSelected
Thanks in advance for your help.
Best regards
Daniel Hey there,
I plotted some data in just one figure, after that, I want to select some plots by mouse in the figure and I want to highlight it by increasing the ‘LineWidth’ and get the information, which of the plotted object has been selected.
In my main script, I use the following code to call the function (dxf.handle contains all the handles, which have been plotted before):
selected_entities = sub_select(dxf.handle);
The function has the following code:
function selected_object = sub_select(H)
set(H, ‘ButtonDownFcn’, selected_object = @LineSelected)
end
function ObjectH = LineSelected(ObjectH, EventData)
set(ObjectH, ‘LineWidth’, 2.5);
end
In general the code works and it’s possible to highlight the objects, but I didn’t get the information, which handle was selected. This information should be stored in selected_entities. At the moment, I just get this:
selected_object = @LineSelected
Thanks in advance for your help.
Best regards
Daniel ‘buttondownfcn’ MATLAB Answers — New Questions