Retrieve Imline handle from axes
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Matt_Z
am 30 Jun. 2016
Kommentiert: Matt_Z
am 30 Jun. 2016
Hi,
having trouble retrieving handle to Imline objects created within an axes. It is running in a multi-step GUI and I am trying to update the Imline position when a user inputs a selection of x and y values.
Issue can be reproduced using below:
fh = figure;
ah = axes(fh);
imshow('pout.tif');
h = imline(ah,[10 100], [100 100]);
clear all % you must put this in as I’m running from the gui
H=get(gca,'Children')
H =
2x1 graphics array:
Group (imline)
Image
setPosition(H(1),[50 200], [140 200])
ERROR: Undefined function 'setPosition' for input arguments of type 'matlab.graphics.primitive.Group'.
Any help would be most appreciated
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 30 Jun. 2016
I confirm that in R2016a. I do not know why it happens. The workaround is
setPosition(H(1).ApplicationData.roiObjectReference,[50 200],[140 200])
Weitere Antworten (1)
Geoff Hayes
am 30 Jun. 2016
Matt - which version of MATLAB are you using? If you are using an older version of MATLAB, you may not have the ability to call the setPosition method and instead will have to update the position property. What properties are returned when you execute the following
get(H(1))
Is there a Position such that you could do
set(H(1), 'Position', 50 200], [140 200]);
Also, why do you "lose" the handle h after you initially create this object? Why the clear all statement?
Siehe auch
Kategorien
Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!