how retain value of variable in memory between calls to the function?
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I am doing sorting every time when function called it should retain its value not like once function job over value of variable gets earsed.SO can you tell how to define that?Is any varible type is there or any other solution?
1 个评论
James Tursa
2016-10-7
Please post a short example showing your code. Tell us specifically what the code is doing that you don't like, and how you would specifically like the code to behave.
回答(2 个)
Les Beckham
2016-10-8
I think what you need is to define the variable(s) that need to be retained as 'persistent' inside your function. Check the docs.
Marc Jakobi
2016-10-8
I think you might want to have a look at object oriented programming in Matlab: mathworks.com/discovery/object-oriented-programming.html
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!