Where is "Go to definition" Feature! Navigating objects and methods in MATLAB
Show older comments
I have a lot of classes and methods in my project. I've been putting up with the lack of "Go to definition" feature/aka Ctrl+click (along with Alt+left and right to navigate back and forth) only because of MATLAB'S speed (It is blazing fast! Even C++ Armadillo can't catch up). However, I'm not sure if it is feasible for long-term algorithm development (+ object-oriented code) without this feature.
Other IDEs like PyCharm, CLion, and Visual Studios all have this, and it makes developing/refactoring code so much more efficient and easier.
Has anyone found a solution for this? Or, is this the price I have to pay to use MATLAB? I've found out about VS Code MATLAB plugin and it is quite great with the colors and all but the "Go to definition" doesn't work for methods.
I've tested the same algorithm with Python+Numpy and it is about 2x slower but it is free and the IDE really accelerates the code development time beyond 2x, so maybe, I'll just have to move to Python?
Answers (1)
Image Analyst
on 29 Aug 2022
Edited: Image Analyst
on 29 Aug 2022
0 votes
- Right click in the function you want to go to the source code of. Then select "Open thatFunctionName".
- Or click in the function name and type control-D.
Not sure about with the VS Code plugin because I don't use that.
8 Comments
Image Analyst
on 29 Aug 2022
It will open methods of a class also. Essentially methods of a class are functions.
Image Analyst
on 29 Aug 2022
Edited: Image Analyst
on 29 Aug 2022
Are you sure correct_hde is a method and not a property? Also is "c:......hde_cal" on the search path or in the current folder? It's worked for all versions I've ever used going back to 2006. I'm using R2022a now.
I tried it now with one of my methods on a static class and it went directly to the source code for that method.
Kaung
on 29 Aug 2022
Kaung
on 29 Aug 2022
Image Analyst
on 29 Aug 2022
If I do this:
e = Excel_utils;
b = e.ActivateSheet
and click somewhere in ActivateSheet, then it won't work UNTIL I run the program. Reason being that the "e" variable does not exist if I'm just not running the program and am just editing. There is no "e" variable yet (while editing) so of course the ActivateSheet method of that (non-existent) class does not either.
Now, if I do
e = Excel_utils.ActivateSheet;
then that works because Excel_utils is not an instance/object - it's a static class.
However if I run the code and put a breakpoint on the b= line of code then I CAN go into the ActivateSheet source code because by that time, the e object has been created, and this ActivateSheet method will be a part of that object.
Kaung
on 29 Aug 2022
Categories
Find more on Search Path in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


