The goal is to be able to write a function which opens the editor to the current stack level. This is fairly easy to do for the top of the stack but more difficult if the current stack level is changed, such as via the use of dbup and dbdown. Opening the editor to a file at a specific line is fairly easy using, matlab.desktop.editor.openAndGoToLine. The difficult part is determining the level.
The simple solution is to do the following:
[s,I] = dbstack('-completenames'); matlab.desktop.editor.openAndGoToLine(s(I).file,s(I).line)
I don't like that this creates variables in the workspace and that it is so long. Ideally, I want to have a simple command like this:
The best solution I have is: eval(open2ws), where open2ws passes a string with the function whos in it, and the nesting information in whos can be used to identify the current function (I think). Any cleaner suggestions?
No products are associated with this question.