How can I instruct MATLAB editor to open a file with focus on specific line/function?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Balaji
am 5 Sep. 2014
Kommentiert: Balaji
am 5 Sep. 2014
Hi,
I have a MATLAB class file in which i have implemented several methods. I am developing a UI around this using GUIDE and in the UI I would like the user to click on a particular method's name. Then Editor should open up the class and instead of having the 1'st line onwards in the view, the user should see the code from the test method onwards.
Is anyone aware of a way to achieve this? If so please share it.
The alternatives fread,fseek may work but a way to do this in the editor is what I am looking for.
Thanks!
0 Kommentare
Akzeptierte Antwort
Sean de Wolski
am 5 Sep. 2014
This can be done using the editor api.
edit your_class.m
hEditor = matlab.desktop.editor.getActive;
hEditor.goToLine(line_number)
3 Kommentare
Joseph Cheng
am 5 Sep. 2014
Bearbeitet: Joseph Cheng
am 5 Sep. 2014
also you can do.
matlab.desktop.editor.openAndGoToLine('fullpath and filename',linenumber)
for a single line.
oh and to go to specific function (without having to keep track of line numbers
matlab.desktop.editor.openAndGoToFunction('full path and file name','function name')
full list can be found here http://blogs.mathworks.com/community/2009/10/26/the-matlab-editor-at-your-fingertips/
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Environment and Settings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!