フィルターのクリア

app designer: how to index through multiple UIAxes

3 ビュー (過去 30 日間)
Scorp
Scorp 2022 年 9 月 21 日
コメント済み: Walter Roberson 2022 年 9 月 21 日
  1. There are 5 UIAxes objects in an App added using the Design View
  2. Component names are: app.UIAxes_1, app.UIAxes_2....
  3. 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
Unable to resolve the name 'app.UIAxes_1'.
This has the error : 'Error using gobjects Inputs must be scalar numeric or a vector of array dimensions'

採用された回答

Walter Roberson
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];

その他の回答 (1 件)

Eric Delgado
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
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 ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by