Static variables in MATLAB

조회 수: 236 (최근 30일)
Anirudh Sharma
Anirudh Sharma 2016년 10월 6일
댓글: Ravi Singh 2020년 4월 23일
How do I declare static variable in MATLAB?

채택된 답변

Abhishek Jain
Abhishek Jain 2016년 10월 6일
편집: madhan ravi 2018년 11월 11일
Use keyword persistent to declare static variables
persistent x;

추가 답변 (1개)

Adam
Adam 2016년 10월 6일
You can use persistent variables if that is what you mean, but only use them if you really need to. Similar to global variables they are far easier to introduce bugs into your workspace with then simply passing variables around between functions or using a class to define the scope of a variable.
  댓글 수: 1
Ravi Singh
Ravi Singh 2020년 4월 23일
Hi Adam ,
I need to assign a static variable in one method call and use the same variable in another method call is there any way to do so ?

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by