Reputation: 3488
I have written a class in MATLAB with properties and functions. The code itself works fine.
I construct the code with
theory = ODtheory;
However if I edit
theory.[Tab]
The code editor does not provide any autocompletion and shows the message
No completions found
How do I get autocompletion for class members in MATLAB?
Upvotes: 1
Views: 169
Reputation: 60750
After a bit of experimenting, I've realized that the MATLAB Editor does not do autocompletion based on the code in the file being edited, instead it does autocompletion based on the value of variables in the base workspace.
If you execute theory = ODtheory;
at the MATLAB command prompt, and then in the Editor create a new function, and type theory.
and then tab, you will see a list of members of ODtheory
, even though theory
was never declared within the new function you just created.
The same is true for variable names, you can auto-complete variable names that exist in the base workspace, even if they don't exist in the function you are editing and are not global.
This is certainly strange.
(Note: I experimented with MATLAB R2017a, but presume this hasn't changed in more recent versions of MATLAB because of the effort they put towards the Live Editor.)
Upvotes: 1