Why does loading my MATLAB Class object with DBSTOP IF ERROR find errors, but normally no errors are found in MATLAB 7.7 (R2008b)
1 回表示 (過去 30 日間)
古いコメントを表示
I have the following class definition:
classdef test
properties (SetAccess = 'private')
p = '';
end
methods
function testobj = set.p(testobj, q)
if ~(strcmp(q,'a'))
error('error')
end
disp('Listened to p');
testobj.p = q;
end
end
end
If you instatiate a copy of the above class by typing,
a = test;
save a
load a
Nothing happens and the code loads. However, if I first type
dbstop if error
and then execute the same lines as before, the debugger finds the error.
採用された回答
MathWorks Support Team
2009 年 6 月 27 日
Generally, the LOAD command tries to load as much as possible and so it never throws real errors unless it detects a corrupt file and is unable to continue. Using "dbstop if all error" is a good way to debug problems during load.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Programming Utilities についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!