Programmatically select a specific object when switching on plotedit
Mostrar comentarios más antiguos
Is there any way to select an object when issuing the command
plotedit(hfig,'on');
I tried to overwrite 'CurrentObject' property but it did not work. There is also a 'CurrentAxes' property, and that did not work either.
Is there any solution?
4 comentarios
Fangjun Jiang
el 16 de Mayo de 2018
Editada: Fangjun Jiang
el 16 de Mayo de 2018
what is ax, axis, axes, figure?
Walter Roberson
el 16 de Mayo de 2018
In what respect would you like it to be selected?
Respuesta aceptada
Más respuestas (2)
Fangjun Jiang
el 16 de Mayo de 2018
f=figure(1);
p=plot(1:10);
ax=findobj(f,'type','axes');
6 comentarios
Csaba
el 16 de Mayo de 2018
Fangjun Jiang
el 16 de Mayo de 2018
What do you mean? You just want to select (or find) the axes, right? Although document says plotedit() toggles the plot edit mode for figure, I find out that you could run plotedit(ax,'on'). It has the same effect as plotedit(f,'on')
Csaba
el 16 de Mayo de 2018
Walter Roberson
el 16 de Mayo de 2018
If the first argument to plotedit is a graphics object but not a figure then plotedit quietly does gcf() instead, ignoring the passed graphics object.
Fangjun Jiang
el 16 de Mayo de 2018
I think "CurrentObject" is read-only. You can't select an object by setting "CurrentObject".
From the document:
CurrentObject — Most recently selected component in figure object
Most recently selected component in the Figure, specified as an object. MATLAB sets the CurrentObject property to the last object the user clicked. This object is the front-most object in the view. You can use this property to determine which object a user has selected.
An object’s HitTest property controls whether that object can become the CurrentObject.
Clicking an object whose HandleVisibility property is off (such as axis labels and title) causes the CurrentObject property to be set to empty. To avoid returning an empty value when users click a hidden object, set HitTest property of the hidden object to 'off'.
Moving the cursor over objects does not update the CurrentObject. Users must click objects to update this property. See the CurrentPoint property for related information.
If you are looking for a quick way to access the current object, consider using the gco command.
Csaba
el 16 de Mayo de 2018
Sean de Wolski
el 16 de Mayo de 2018
Are you perhaps looking for inspect?
inspect(axes)
Note, this has gotten a lot better in 18a.
1 comentario
Csaba
el 16 de Mayo de 2018
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!