Static variables in MATLAB
조회 수: 236 (최근 30일)
이전 댓글 표시
How do I declare static variable in MATLAB?
댓글 수: 0
채택된 답변
Abhishek Jain
2016년 10월 6일
편집: madhan ravi
2018년 11월 11일
Use keyword persistent to declare static variables
persistent x;
댓글 수: 0
추가 답변 (1개)
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
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 Center 및 File Exchange에서 Entering Commands에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!