Update Class without restarting matlab

Hello Matlabers
I am working on a GUI and have implemented some of my own classes (all stored in @classname folder with subfunctions in there too - as told on the mathworks website).
When I need to do some changes to methods/functions in my classes, they somehow do not get updated after saving. When I restart my gui (where tha objects are created) I still get the old implementations.
I always close all the windows/guis and do "close all" but this does not seem to work - even "pack" has no influence.
Thus I found that in order to have an updated class I need to restart my Matlab and then things work perfectly.
There has to be a more convenient way, hasn't it?

 採用された回答

Robert Cumming
Robert Cumming 2011 年 4 月 6 日

2 投票

This is because Matlab does a certain amount of cacheing of classes in memory - as indicated by Walter the way to update is to use
clear classes

4 件のコメント

Jonas Reber
Jonas Reber 2011 年 4 月 7 日
I usually go with "clear all" - doesn't this include clear classes too?
Robert Cumming
Robert Cumming 2011 年 4 月 7 日
No it doesn't. from the matlab help:
CLEAR CLASSES is the same as CLEAR ALL except that class definitions are also cleared
Jonas Reber
Jonas Reber 2011 年 4 月 12 日
perfect, thank you!
Vasco
Vasco 2020 年 9 月 17 日
Is there a way to only reload a specific class?
When developing code, I quite often only change one class. Reloading all classes (and rereading data) takes significant time.

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2011 年 4 月 6 日

0 投票

Have you tried using "clear" of the class? Have you tried using "rehash", perhaps even "rehash toolboxcache" ?

1 件のコメント

Peter Manley-Cooke
Peter Manley-Cooke 2011 年 4 月 6 日
As in the command "clear classes". You will then need to re-instantiate you classes. I do it by restarting the GUI.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeClass Introspection and Metadata についてさらに検索

質問済み:

2011 年 4 月 6 日

コメント済み:

2020 年 9 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by