Application Designer Access elements on panel

조회 수: 8 (최근 30일)
Larry McDermott
Larry McDermott 2020년 4월 15일
댓글: Larry McDermott 2020년 4월 24일
Hello Community,
I've started migrating to the app developer (from GUIDE), and am finding a few questions I can't figure out.
The main one is that I like using Panels to segregate different functions, such as data input in one panel, configuration settings in a different panel etc.
If I read the value in an element (ex. textbox.Text or textbox.Value) I can do that on a callback from a button that is in the same panel.
If I try to access this field from a button callback that doesn't reside in the panel I get "Undefined variable" messages. For example:
In the panel SetupPanel I have a text box named txt-nRuns. If I put a button in the same SetupPanel I can read the value with "nruns=app.txt_nRuns.Value"
If I try to read the value from a button on the main form (or in another panel) I get the "undefined variable" response. It seems like it's treating the elements in the panel as local variables.
I tried different options likeb elow with no luck, any tips on what I'm doing wrong (or if this is not currently possible)?
nruns=app.txt_nRuns.Value
nruns=app.SetupPanel.txt_nRuns.Value
nruns=app.SetupPanel.app.txt_nRuns.Value
nruns=SetupPanel.app.txt_nRuns.Value
Thanks for any suggestions!
  댓글 수: 3
Sahithi Kanumarlapudi
Sahithi Kanumarlapudi 2020년 4월 21일
Hi,
As mentioned in the previous comment, that should not be a problem. Could you provide the code so that I can look into it?
Larry McDermott
Larry McDermott 2020년 4월 24일
Thanks for your response, everything is working fine now. I'm not sure what I was doing wrong but I've since started using panels with no problems.

댓글을 달려면 로그인하십시오.

채택된 답변

Larry McDermott
Larry McDermott 2020년 4월 21일
Thanks for the follow up, I've worked around it (by excluding the panels) for now.
I just tried using a simple app and it all works! Not sure what I was doing last time but glad it works, sorry for the false alert!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by