필터 지우기
필터 지우기

How to define a global variable

조회 수: 2 (최근 30일)
Ni2
Ni2 2019년 10월 22일
댓글: Steven Lord 2019년 10월 23일
My app has many button with their own callbacks. I wanna define a variable inside one of such callbacks and i want to use it in other places including startupfcn, properties etc.

답변 (2개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 10월 22일
편집: KALYAN ACHARJYA 2019년 10월 22일

Steven Lord
Steven Lord 2019년 10월 22일
While you can use global variables for this type of sharing, we recommend you use other techniques instead. See the "Share Data Within App Designer Apps" topic on this documentation page if you're using App Designer. If you're using GUIDE or creating the app programmatically, see the "Share Data Among Callbacks" topic on this documentation page.
  댓글 수: 3
Ni2
Ni2 2019년 10월 22일
Btw whats the difference between private and public property ?
Steven Lord
Steven Lord 2019년 10월 23일
See the descriptions of the Access, GetAccess, and SetAccess property attributes in the documentation. These attributes control who can query and change the property's value and from where they can be queried or changed.
If you stored your name in a property of the you object, it would likely have public GetAccess (anyone can ask you for your name) but would not have public SetAccess (few people have the right to change your name.)
Your bank account number would not have public GetAccess (not everyone should be able to know that information.)

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

카테고리

Help CenterFile 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!

Translated by