Wednesday, April 03, 2013

Matlab Long Simulation Interactive Debug , Set Debug flag using GUI , Pause execution to debug

Create a button function:


function util_DebugGuiButtons()
global debugFlag;
uicontrol('Position',[30 10 35 40],'String','||','Callback',@wait);
uicontrol('Position',[70 10 35 40],'String','>>','Callback',@dontwait);
function wait(hObject,eventdata)
debugFlag = 1;
end

function dontwait(hObject,eventdata)
debugFlag = 0;
dbcont;
end
end



Define in top of document:
global debugFlag


Put this inside your loop :


    if (debugFlag)
        dbstop in file.m at line
end



Continue Button is not working as desired now. It just clears the breakpoints but does not issue dbcont command properly. I will try to figure out later.

AI

Despite the benefits of AI we are starving for humanity.