Info

This question is closed. Reopen it to edit or answer.

What is wrong with: dbstop in sake_cut_block2 at 10 if 'i == 559' ?

1 view (last 30 days)
Hello,
I would like to pause the execution of a function (I wrote) at a specific location, when an expression evaluates to true.
More specifically, I have a counter (i), and when it reaches a specific value, I want MATLAB to pause the execution and enter debug mode.
From the documentation (<http://uk.mathworks.com/help/matlab/ref/dbstop.html?refresh=true)>, I understand that the command below should do the trick, but the file does not pause.
dbstop in sake_cut_block2 at 10 if 'i == 559'
Can anyone tell me what I am doing wrong? - thanks!

Answers (2)

Image Analyst
Image Analyst on 13 Nov 2015
I didn't see where they made the condition a string. What happens if you just use the condition as a boolean and not as a string literal?
dbstop in sake_cut_block2 at 10 if i == 559
  4 Comments
Karin
Karin on 13 Nov 2015
It turns out that stopping at a line where there is a for loop starting (which was the case of my file) is not supported. So make sure you specify a line for the dbstop that is not where a loop starts.
Image Analyst
Image Analyst on 13 Nov 2015
Ah - a key thing you left out (the line of code it was supposed to stop on). Another thing - if the line you say to stop on is a comment, then it will stop at the next executable line of code.

Karin
Karin on 13 Nov 2015
It turns out that stopping at a line where there is a for loop starting (which was the case of my file) is not supported. So make sure you specify a line for the dbstop that is not where a loop starts.

Tags

Community Treasure Hunt

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

Start Hunting!