app designer: how to index through multiple UIAxes
조회 수: 10 (최근 30일)
이전 댓글 표시
- There are 5 UIAxes objects in an App added using the Design View
- Component names are: app.UIAxes_1, app.UIAxes_2....
- How do I index through each Axes component to update the plots?
Have tried:
app.plotHandles = gobjects([app.UIAxes_1,app.UIAxes_2,app.UIAxes_3,app.UIAxes_4,app.UIAxes_5])
for i=1:5
plot(app.plotHandles(i),x(i),y(i));
end
This has the error : 'Error using gobjects Inputs must be scalar numeric or a vector of array dimensions'
댓글 수: 0
채택된 답변
Walter Roberson
2022년 9월 21일
app.plotHandles = gobjects([app.UIAxes_1,app.UIAxes_2,app.UIAxes_3,app.UIAxes_4,app.UIAxes_5])
The gobjects() function only accepts size-related arguments -- the number of objects to create or the dimensions of the object array.
You should use
app.plotHandles = [app.UIAxes_1, app.UIAxes_2, app.UIAxes_3, app.UIAxes_4, app.UIAxes_5];
댓글 수: 0
추가 답변 (1개)
Eric Delgado
2022년 9월 21일
편집: Eric Delgado
2022년 9월 21일
Hey... just put in the startup of your app the code below.
app.plotHandles = findall(app.UIFigure, 'Type', 'axes');
댓글 수: 1
Walter Roberson
2022년 9월 21일
There is a risk that the order might not be what is needed.
There is a risk that there are other uiaxes as well.
There is a risk that there are standard axes that are not uiaxes.
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!