채택된 답변

Abhishek Jain
Abhishek Jain 2016년 10월 6일
편집: madhan ravi 2018년 11월 11일

6 개 추천

Use keyword persistent to declare static variables
persistent x;

추가 답변 (1개)

Adam
Adam 2016년 10월 6일

1 개 추천

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 ?

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

카테고리

도움말 센터File Exchange에서 Scope Variables and Generate Names에 대해 자세히 알아보기

태그

질문:

2016년 10월 6일

댓글:

2020년 4월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by