Global variables in Matlab app

조회 수: 4 (최근 30일)
Gekkouga
Gekkouga 2020년 10월 18일
답변: Pratheek Punchathody 2020년 10월 21일
Hi,
How to specify global variables in Matlab app?
I need to access both symbolic and numeric variables across funtions within a Matlab app. So, I thought of creating global variables. I created a startup function and declared my global variables in there. But for some reason they are not global and are not accessible outside of my startup function.
Thanks in advance for the suggestions.
Thanks,
Abinav.
  댓글 수: 3
Gekkouga
Gekkouga 2020년 10월 18일
It's not a usual function. It's a Matlab app and I want to transfer data between 1 call back function to other (1 button press function to other). I don't know other ways of transfering data except global variables. Besides, it's the same variable that is being used in both the call back functions.
Walter Roberson
Walter Roberson 2020년 10월 18일
Create a property to store the value.

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

답변 (1개)

Pratheek Punchathody
Pratheek Punchathody 2020년 10월 21일
For transferring data between one callbacks function to another, you can use “properties” which can be accessible to all functions and callbacks in an app.
"Public Properties" are accessible both inside and outside the app, whereas private properties are only accessible inside of the app.
Refer to the documentation on Share Data Within App Designer Apps for further details on defining properties.

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by