Borrar filtros
Borrar filtros

How to Assign an Axes Object to a struct?

4 visualizaciones (últimos 30 días)
Rightia Rollmann
Rightia Rollmann el 21 de Feb. de 2017
Editada: Jan el 22 de Feb. de 2017
It seems that MATLAB automatically assign h2Axes to struct G, not hAxes. How can I specifically assign hAxes to struct G?
hAxes = axes('NextPlot', 'add', 'XLim', [0, 20], 'YLim', [-1, 10], 'Position', [0 0 0.5 0.5]);
h2Axes = axes('NextPlot', 'add', 'XLim', [0, 20], 'YLim', [-1, 10], 'Position', [0.5 0.5 0.5 0.5]);
W = 4;
Y = 0;
H = 8;
for i = 1 : 3
X = i.* W;
R = rectangle;
R.Position = [X Y W H];
G(i).r = R;
end

Respuesta aceptada

Jan
Jan el 22 de Feb. de 2017
Editada: Jan el 22 de Feb. de 2017
hAxes = axes('NextPlot', 'add', 'XLim', [0, 20], 'YLim', [-1, 10], 'Position', [0 0 0.5 0.5]);
h2Axes = axes('NextPlot', 'add', 'XLim', [0, 20], 'YLim', [-1, 10], 'Position', [0.5 0.5 0.5 0.5]);
W = 4;
Y = 0;
H = 8;
for i = 1 : 3
X = i.* W;
R = rectangle('Parent', hAxes);
% Or:
% R.Parent = hAxes;
R.Position = [X Y W H];
G(i).r = R;
end

Más respuestas (0)

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by