- ensure all the non-static methods in a class use the same object name (like thisMy inside MyClass) as the constructor,
- update a setup.m file, in the MyClass section, with a struct thisMy that has all the properties and methods in it, with the properties being the right type (with the type put into a special comment).
Matlab intellisense (auto completion) for objects of user defined classes in Script files (.m File)
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Observer
am 23 Jul. 2014
Bearbeitet: Randy Strauss
am 16 Apr. 2020
I would like to know that is there a way for intellisense to work for user defined classes. If I create object of user defined class in command window that I can see the properties and method of that class by pressing the tab button in front of "Object + .". However, if I create object in a script file or function file then intellisense does not work. Do I need to enable some functionality or Matlab does not have this capability. Thanks
1 Kommentar
Randy Strauss
am 16 Apr. 2020
Bearbeitet: Randy Strauss
am 16 Apr. 2020
Wow, this is pretty horrible.
One could do something convoluted and define this.x be a certain class to get prompting with a class property, but private properties, which one should see inside a class, are still invisible to it.
Hey, maybe someone will write a parser to:
Or, MatLab, how about fixing your IDE so it can have types for variables and properties, like every other decent language has?
An easy first step is for the IDE to assume it knows the type of the first parameter of non-static methods, plus that it should include prompting with private property and method names...
Akzeptierte Antwort
Friedrich
am 23 Jul. 2014
Bearbeitet: Friedrich
am 23 Jul. 2014
Hi,
MATLAB cannot deal with that for now.
As a small trick, create an instance of your class in the base workspace and go back to writing your actual code.
So for example execute in the command window
a = serial('COM1');
And then go to your function you are writing and use "a.<Press TAB>" and you will see that autocompletion works.
In the case you cannot create an instance of your class use .empty this will also work fine:
a = YOURCLASS.empty(1,0);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Construct and Work with Object Arrays finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!