Breakpoint does not work

5 ビュー (過去 30 日間)
Devin
Devin 2018 年 11 月 27 日
コメント済み: Devin 2018 年 11 月 27 日
Greetings,
I meet a very weird problem about breakpoint and none of my friends cannot solve it.
I put two breakpoints in 43 and 44 lines of Model class as Figure 1 shows.
When I runned the program, it stopped as Figure 2. From Figure 2, we can see the program never stopped at 43 and 44 lines, but directly threw the error and even skipped the 43 line disp(t).
However, if I put breakpoints at 42 lines and rerunned it, it can stop normally as Figure 3. But it still skipped 43 line and threw the error as Figure 2; and cannot stop at 43 and 44 lines, when exitflag was not 1.
In addition, I used "clear" in the main script, not "clear all". My Matlab version is R2018a.

採用された回答

Steven Lord
Steven Lord 2018 年 11 月 27 日
The fact that the stack for the error includes the function parfinitedifferences suggests to me that the condition to enter that if statement is only satisfied on one of the workers used to evaluate the finite difference in parallel (you're passing the UseParallel option to fmincon, right?) In that case the breakpoint that was set on the client is not present on the workers.
You probably wouldn't want to enter debug mode on the workers anyway as they fall into the same general category as input and keyboard as called out on this documentation page. The worker would wait at the breakpoint for input that you couldn't give it.
  1 件のコメント
Devin
Devin 2018 年 11 月 27 日
Your guess is totally correct! I used fmincon under parallel computation. And the function where I put breakpoints is evaluated in fmincon parallelly.
Your exaplaination of the breakpoint on the client also make sense. To debug it, I turend off the parallel computation and it works.
Thank you very much !!!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by