Variable with static type possible?
6 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
Wayne King
2013-12-29
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
2013-12-29
However it is still possible to assign something of a different type to the variable.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Java from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!