how retain value of variable in memory between calls to the function?

조회 수: 5 (최근 30일)
ayyappa rudrasimha yedida
ayyappa rudrasimha yedida 2016년 10월 7일
댓글: Marc Jakobi 2016년 10월 8일
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
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
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
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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by