From: Solomon Hurst on
"Solomon Hurst" <solomon.hurst(a)bendix.com> wrote in message <h9jajg$22i$1(a)fred.mathworks.com>...
> "Solomon Hurst" <solomon.hurst(a)bendix.com> wrote in message <h9j99d$4k6$1(a)fred.mathworks.com>...
> > "Solomon Hurst" <solomon.hurst(a)bendix.com> wrote in message <h9j7pu$p63$1(a)fred.mathworks.com>...
> > > Hello,
> > >
> > > I am using the FEX submission "makedatatip" by Tim Farajian to add data cursors with the update of a slider.
> > > However, I would like to remove data cursors attached to any other targets of the figure.
> > > I tried adding the handles of the data cursors to an array and running "delete" on the elements of the array I no longer wanted, but doing so gave me a "Invalid object handle" error when the data cursors still tried to update.
> > > Is there a simple way to programmatically get all data cursors for a figure and remove them?
> > >
> > > Any help is appreciated.
> > > -SRH
> >
> > Minor update: I found out the DataCursors actually belong to the datacursormode object, not the figure itself. However, setting the DataCursors property of the datacursorsmode object to [] does not seem to remove them.
>
>
> I tried a different approach, still with no luck.
> Instead of removing datatips I didn't want it may be acceptable to just restrict it to one and change the position of that one datacursor. Unfortunately I have had no success with this either.
> I can see the datatip object in the datacursormode object, but when I try to update the "Position" property I get an out of index error. Strangely enough I don't even SEE a Position property when looking at it in the object inspector. There is a UIContextMenu Property which has a position Property, but looking at the original value I can tell that is certainly not what I am looking for.
>
> If anyone has any ideas they would be greatly appreciated.
>
> -SRH

One other interesting observation I encountered while trying to use this method... when I change that "position" property the cursor itself disappears, though the window displaying the position does not. When I click the figure this window then disappears.
Unfortunately this would not be acceptable... the datacursors must be completely removed without user interaction.