Is it possible to declare a variable with a static type, the way it is in Java? So that I can only asign an object of the correct type to that variable?
Thank you.

 채택된 답변

Wayne King
Wayne King 2013년 12월 29일

0 개 추천

To get the equivalent of a static variable in MATLAB, use persistent. When you declare a variable to be persistent within a function, its value is retained in memory between calls to that function.

댓글 수: 1

Walter Roberson
Walter Roberson 2013년 12월 29일
However it is still possible to assign something of a different type to the variable.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Java Package Integration에 대해 자세히 알아보기

질문:

2013년 12월 29일

댓글:

2013년 12월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by