Saving breakpoints in a script

17 ビュー (過去 30 日間)
alpedhuez
alpedhuez 2018 年 4 月 30 日
編集済み: Jan 2022 年 8 月 1 日
Suppose I put breakpoints in a script. I want to save these breakpoints so that I can reuuse them in a next session.
I have seen
https://stackoverflow.com/questions/12657219/how-to-restore-breakpoints-in-matlab-after-clear-all
Then what would be the specific steps to save breakpoints? Shall I just put
%# store breakpoints
tmp = dbstatus;
save('tmp.mat','tmp')
%# clear all
close all
clear classes %# clears even more than clear all
clc
%# reload breakpoints
load('tmp.mat')
dbstop(tmp)
%# clean up
clear tmp
delete('tmp.mat')
at the beginning of the script?

採用された回答

Jan
Jan 2018 年 4 月 30 日
No, do not insert this into the script. Keep the information about debugging and the actual code separated.
When you want to store the breakpoints, call:
status = dbstatus;
save('DBStatus.mat', 'status')
and to restore them, run:
Data = load('DBStatus.mat');
dbstatus(Data.status);
Maybe you want to store this in a function.
  5 件のコメント
Omer Ben-Yshai
Omer Ben-Yshai 2019 年 12 月 31 日
right.
Michael Needham
Michael Needham 2022 年 8 月 1 日
This works, except for the last command I used dbstop(DataStat.status);

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by