Problem with dbstop if error in 2018b

After downloading Matlab 2018b, I started having the following problem using the command dbstop if error:
My code will stop at the error as usual but then at some point later as I am debugging (typing variable names in the command line to check their values, etc.), the debugger will stop at line 43 of getArrayEditorBrushCache which reads:
eval(['I = I' subsstr ';']);
Then I have to type dbclear if error to escape the debugger and start my program over.
This is happening to me in many of my programs where dbstop if error was working fine in previous versions of Matlab. Any ideas for how to solve this or is this just a new bug?

回答 (2 件)

madhan ravi
madhan ravi 2019 年 1 月 13 日

0 投票

When it occurs type
dbquit % help dbquit to know more
Stefano
Stefano 2019 年 2 月 19 日

0 投票

There is an awful (IMHO) piece of code for taking the indexes of an array:
parenStart = strfind(varName,'(');
subsstr = '';
if ~isempty(parenStart)
subsstr = varName(parenStart:end);
varName = varName(1:parenStart(1)-1);
end
And when trying to index the variable I:
if ~isempty(subsstr)
eval(['I = I' subsstr ';']);
end
it produces an error if varName was (in) (part of) an array of structures, objects, or symilar types with a dot, like:
struct(5).fieldname
I don't have the time to make a patch, and in any case I think it should be addressed by MathWorks...

6 件のコメント

Jan
Jan 2019 年 2 月 19 日
A patch might be:
parenStart = strfind(varName, '(');
subsstr = '';
if ~isempty(parenStart)
parentEnd = strfind(varName, ')');
subsstr = varName(parenStart(1):parentEnd(1));
varName = varName(1:parenStart(1)-1);
end
Did I mention already that eval is a shot in your knee?! This is another example, although here this command is not the actual cause of the error. Such partial hand made parsing of code is extremely prone to bugs. Matlab does have perfect tools for parsinge a line of code already, so why re-inventing a square wheel?
Andrei
Andrei 2019 年 8 月 16 日
Jan, what these users are reporting, is the bug in Mathworks code (eval including). I came across this myself and it is very annoying. I cannot patch this because on my system I cannot write to Matlab installation folder.
Jan
Jan 2019 年 8 月 19 日
@Andrei: Please report this bug to MathWorks.
Stefan
Stefan 2020 年 2 月 29 日
@Andrei: I have the same bug and permission problem.
A temporal workaround is to modify getArrayEditorBrushCache.m according to Jan's above patch and save it into your working folder. For me, this perfectly solved the issue.
Adrian Cherry
Adrian Cherry 2023 年 8 月 24 日
Was this ever reported as a bug to Mathworks? I've just come across it in R2023a and it's f****ing annoying.
Yinjie
Yinjie 2024 年 3 月 16 日
% it works
if ~isempty(subsstr)
try
eval(['I = I' subsstr ';']);
catch
I = false;
end
end

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

カテゴリ

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

質問済み:

2019 年 1 月 13 日

コメント済み:

2024 年 3 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by