Debugging a function line by line from another script
이전 댓글 표시
Hello All,
Here is the minimum working example for what I am trying to do:
% main script to run a function
a = 1;
b = 2;
c = fun(a,b);
% script end
function out = fun(a,b)
d = 1;
out = a + b;
end
I would like to programmatically debug the function 'fun' from the workspace of the main script in such a manner that I can get the information about what is going on in each line of the function 'fun'. When I tried 'dbstop' right before the function 'fun' is called, debugger puts a break point at the first executable line inside the 'fun' and waits there. I would like to silently (meaning not being taken to breakpoint in 'fun') debug line by line through the 'fun' programmatically without leaving the workspace of main script. Is that possible ? Thanks in advance for your help. Any help is greatly appreciated.
-Anand
댓글 수: 1
Guillaume
2015년 6월 18일
That makes no sense to me. In order to debug the function, that is see what it does, you need to see the variables it is operating on, so you need to be in its workspace. Otherwise, what's the point?
Note that you can always switch back to the script workspace while in the function with dbup (and go back to the function workspace with dbdown). But your function won't have any influence on the script workspace (unless it's using globals or evalin and co.), so again there's little point in it.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Database Toolbox에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!