Cannot get rid of "Warning: The class file for 'XXX' has been changed; but the change cannot be applied because objects based on the old class file still exist"
3 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I tried to do 'clear', 'clear all', 'clear classes' etc (as suggested in the warning message itself!). I even embedded my test-code in a try catch:
try
test_code
catch ME
show_error(ME)
clear classes
clear all
end
as an attempt to clear data before leaving my test-function, but nothing helps. It now turns out that I have to restart MATLAB (R2012a) every time an error occurs in one of my classes in order to continue developing. Extremely annoying... Hopefully somebody has a remedy for this...
Best regards,
Jeroen
0 件のコメント
回答 (1 件)
Tushar Sinha
2015 年 11 月 5 日
Hi Jeroen,
You might be facing this issue as there might be an intermediate instance being created which is not being destroyed. To resolve this issue, make use of a destructor and then delete the object yourself instead of leaving the it to clear function to destroy it.
methods
function delete(obj)
% obj is always scalar
...
end
end
You can destroy handle objects by explicitly calling delete on the object:
delete(obj)
Refer to the link below for more information on Handle Class Destructor: http://www.mathworks.com/help/matlab/matlab_oop/handle-class-destructors.html
Another way to handle this would be to use "clear classes" multiple times in your code
I hope this helps!
Thanks,
Tushar
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Construct and Work with Object Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!