Until the advent of drawline, it was easy to find the handle to a line objects created using imline:
fighl = figure;axhl = axes(fighl);imagesc(axhl, rand(100));colormap grayimline(axhl, [10 50; 80 50])findobj(axhl, 'type', 'line')ans = 4×1 Line array: Line (end point 2) Line (end point 1) Line (top line) Line (bottom line)
Repeating the same functionality using drawline:
fighl = figure;axhl = axes(fighl);imagesc(axhl, rand(100));colormap graydrawline(axhl, 'position', [10 50; 80 50])findobj(axhl, 'type', 'line')ans = 0×0 empty GraphicsPlaceholder array.
I know that this object exists:
>> findobj(axhl)ans = 3×1 graphics array: Axes Line Image
However, any attempt to access the object handle returns an empty placeholder.
I need to be able to find line objects without having to explicitly store their handles.
Is there a way to achieve this?
Best Answer