MatLab: Saving result and also in which line of which m-file the computation was done -
i have main.m goes
delete output.txt diary output.txt x=1 y=2 diary off
and a.m contains
function [a1, a2] = a(x,y) a1=x+y a2=x-y while a1<5 a1=a1+1 end
i want matlab save output txt file has every computational result @ line of m-file computation done:
x=1 main.m, line 3 y=2 main.m, line 4 a1 = 3 a.m, line 2 a2 = -1 a.m, line 3 a1 = 4 a.m, line 5 a1 = 5 a.m, line 5
i haven't heard standard way of doing this. if there undocumented way of doing this, make debugging extremely convenient. have idea?
the easist way display result function disp
in matlab - http://www.mathworks.com/help/matlab/ref/disp.html
you need come-up framework of output results. example, using code example:
if x==1 disp('main.m - line 3') elseif y==2 disp('main.m - line 4') elseif a1==3 disp('a.m, line 2') elseif a2==-1 disp('a.m, line 3') elseif a1==4 disp('a.m, line 5') elseif a1==5 disp('a.m, line 5') end
this of course workaround think can idea behind this
Comments
Post a Comment