I made a custom class where files are loaded by the constructor and by methods (the path is given as input), e.g.:
Classdeclaration:
classdef Foo > handle
methods
function o = Foo(file), end
function bar(o,file), end
end
end
TC.xml file:
<binding name="Foo" ctype="FILE"/>
<binding name="bar" ctype="MCOSCLASS FILE"/>
Matlab command prompt:
s = Foo('
+ Tab
does list available files.
s.bar('
+ Tab
works
But the problem is that Tab completion is not limited to the class Foo. The trick to change the TC.xsd
did not help as well unfortunatly. Yair Altman help me luckely so far to get to this point. Thx again for that.
The whole procedure can be found here:
methodsview( packagename. classname ) displays information about the methods in the class classname . If the class is in a package, include packagename . If classname is a MATLAB® or Java® class, methodsview lists only public methods, including those methods inherited from superclasses.
To call a static method, prefix the method name with the class name so that MATLAB can determine what class defines the method. Call staticMethod using the syntax classname . methodname : r = MyClass.
Firstly, here is a related topic, which contains an answer to a similar question: Tab-completion of filenames as arguments for MATLAB scripts
Then, here is an article on a good Matlab portal on the same topic: Setting desktop tab completions | Undocumented Matlab
UPD: Unfortunately, although there were some TAB-completion improvements introduced in the version R2010a,
Because tab completion uses static analysis, it doesn’t try to guess at the data type for a variable, so things after a “.” such as properties and fields won’t be completed unless that variable is also defined in the workspace.
And it is dubious if there is some more recent info on topic (at least, I did not find any).
Therefore, it is most probably not possible in current version to auto-complete dot properties and methods in MatLab without statically adding all of them to the *.XML file.
Hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With