I have a long script calling many other scripts that spit out a lot of figures.
For debugging purposes I think it would be useful if -when clicking on a picture- the editor goes to a specific line. Does anyone know if this is possible?
I thought I could implement something like
A=[];
figure
plot(x)
A=ginput(1)
if A~=[]
goto(pointer,line)
end
The problem is that it only would work only right after that the figure is made. Not at the end of the analysis when I take a look to the figures for eventual errors.
In other words: is there a way to go to a specific line of the code by clicking on a figure?
N.B. For an implementation of GOTO see (GOTO FileExchange)
You can use this
undocumented function
:It works for me in r2015a
Try using the
opentoline
function in conjunction with a callback. Something likeIn this case, when you click on the figure (not the axis, or any labels, but the grey part of the figure) the m file will open in the editor to the line specified.
If you want to programmatically determine the line number then do the following