|
Hoi,
Try this:
>> p = imline;
>> setPositionConstraintFcn(p,@(pos) [pos(:,1) repmat(mean(pos(:,2)),2,1)])
Cheers,
Brett
"Hoi Wong" <wonghoi.ee@gmailNOSPAM.com> wrote in message
news:gr931n$60h$1@fred.mathworks.com...
> Is there a simple way to create a draggable line (horizontal) and trigger
> a callback function when the line is moved? I tried imline(), but I was
> unable to prevent the users from moving the end points so that the line is
> slanted, nor the setPosition in the callback function does anything to
> move the line. Any suggestions? I also tried dualcursor in file central,
> but since my axes is in a panel, it breaks a lot of the functions inside.
>
> Thanks in advance.
>
> -- Hoi
|