Prev: Radial basis function network
Next: 802.11s
From: Richard on 30 Dec 2009 18:19 Hi, I'm learning to program with functions, and I'm finding it difficult to debug them. I was wondering if there was a way to access variables that are used only within functions after stopping execution or after an error. Thanks for any help! Ricky
From: RjOllos on 31 Dec 2009 01:01 On Dec 30, 3:19 pm, "Richard " <calk...(a)gmail.com> wrote: > Hi, > > I'm learning to program with functions, and I'm finding it difficult to debug them. I was wondering if there was a way to access variables that are used only within functions after stopping execution or after an error. Thanks for any help! > > Ricky From the command line try: dbstop if error
From: ImageAnalyst on 31 Dec 2009 01:15 On Dec 30, 6:19 pm, "Richard " <calk...(a)gmail.com> wrote: > Hi, > > I'm learning to program with functions, and I'm finding it difficult to debug them. I was wondering if there was a way to access variables that are used only within functions after stopping execution or after an error. Thanks for any help! > > Ricky --------------------------- Yes of course. Just set the breakpoint and hover your cursor over the variable. Type control-D if you want to bring it up in the variable editor panel, which will let you see larger and more complicated variables than hovering can show. If you're stopped in your function, then you will be able to see the variables that are in scope there in your function.
From: Steven Lord on 31 Dec 2009 20:35 "Richard " <calkuta(a)gmail.com> wrote in message news:hhgn5a$ctv$1(a)fred.mathworks.com... > Hi, > > I'm learning to program with functions, and I'm finding it difficult to > debug them. I was wondering if there was a way to access variables that > are used only within functions after stopping execution or after an error. > Thanks for any help! Yes; use the debugging capabilities built into MATLAB and the MATLAB Editor: http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/f2-4931.html The short, short version: click on the little lines next to the line numbers when the file is open in the Editor to set a breakpoint; when you run the code, MATLAB will enter debug mode when it reaches the breakpoint. Use DBSTEP or DBCONT when you want to step through the code or continue execution. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
|
Pages: 1 Prev: Radial basis function network Next: 802.11s |