コンポーネントへの処​理を変数などで管理し​たい(webアプリ)

コンポーネントの編集フィールドの名前がapp.EditField_test01だった場合に
x = 'test01';
strcat('app.EditField_', x, '.Value') = 100;
のような処理を行いたいのですが、うまくいきません。
このような処理が可能であれば、複数のコンポーネントへの処理を関数化できるので
助言をお願いいたします。

답변 (1개)

Atsushi Ueno
Atsushi Ueno 2023년 5월 24일

0 개 추천

structName.(dynamicExpression)
上記の文法で動的なフィールド名の指定が可能です。
app.EditField_test01.Value = 100;
x = 'EditField_test01';
app.(x).Value % app.EditField_test01.Valueにアクセスしている
ans = 100

카테고리

도움말 센터File Exchange에서 アプリの作成에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

2023년 5월 24일

답변:

2023년 5월 24일

Community Treasure Hunt

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

Start Hunting!