필터 지우기
필터 지우기

How to Assign an Axes Object to a struct?

조회 수: 4 (최근 30일)
Rightia Rollmann
Rightia Rollmann 2017년 2월 21일
편집: Jan 2017년 2월 22일
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

채택된 답변

Jan
Jan 2017년 2월 22일
편집: Jan 2017년 2월 22일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by