Debugger not stopping on marker

4 ビュー (過去 30 日間)
Bob Thompson
Bob Thompson 2021 年 3 月 16 日
コメント済み: Jan 2021 年 3 月 18 日
I have a short code that I have put a debug marker in, before running it, but when it gets run the code moves past the marker and stops on an error. There isn't any logic that should cause it to skip over (I can move the marker seemingly anywhere in the code before the error and it still gets skipped.)
Anybody have any suggestions?
The code looks something like the following:
for ii=200:200:30000
command=['!systemcommand outfile.dat.' num2str(ii) ' 9.0932 0.0000 1.8288 > File.out'];
eval(command);
fid=fopen('File.out');
for jj=1:200
linep=fgetl(fid); % Crashes here.
if length(linep) >=2
if strcmp(linep(1:5),'T ')
T=[T;str2double(linep(6:end))];
elseif strcmp(linep(1:6),'taubeg')
t=[t;str2double(linep(10:end))];
end
end
end
fclose(fid);
end
  6 件のコメント
Rik
Rik 2021 年 3 月 17 日
Why use eval when you can avoid it? eval will never be faster and will always call attention. I would classify it as a code smell. It might not actually make a big difference here, but it will be interpreted as a sign that you either don't know or don't care about good coding practices.
Jan
Jan 2021 年 3 月 18 日
@Bob Thompson: Avoiding EVAL is a good programming practize, not only in MATLAB, but as well in other interpreted langauges. MATLAB's code analysis cannot estimate the side effects of an EVAL command and therefore this command can have side-effects on the JIT acceleration although no variables have been defined dynamically.

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

回答 (1 件)

Image Analyst
Image Analyst 2021 年 3 月 17 日
Are you sure the file is saved before you try to set the breakpoint? I notice that if you stop at a break point, edit the code, and then try to set another breakpoint, it won't let you. And you can't save it while it's running or stopped at a breakpoint. You have to stop running completely, then save it, then set your breakpoint.
  3 件のコメント
Image Analyst
Image Analyst 2021 年 3 月 17 日
Call tech support and they'll do a screen-sharing session with you.
Bob Thompson
Bob Thompson 2021 年 3 月 17 日
Thanks, I'll look into that.

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

カテゴリ

Help Center および File ExchangeBig Data Processing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by