我制作了一个自定义类,其中文件由构造函数和方法加载(路径作为输入给出),例如:
类声明:
classdef Foo > handle
methods
function o = Foo(file), end
function bar(o,file), end
end
end
TC.xml 文件:
<binding name="Foo" ctype="FILE"/>
<binding name="bar" ctype="MCOSCLASS FILE"/>
Matlab 命令提示符:
s = Foo('
+ Tab
列出可用文件。
s.bar('
+ Tab
有效
但问题是 Tab 补全并不局限于 Foo 类。不幸的是,更改 TC.xsd
的技巧也没有帮助。到目前为止,Yair Altman 幸运地帮助我达到了这一点。再次感谢。
整个过程可以找到here :
最佳答案
首先,这是一个相关主题,其中包含对类似问题的回答:Tab-completion of filenames as arguments for MATLAB scripts
然后,这是一篇关于同一主题的优秀 Matlab 门户文章:Setting desktop tab completions | Undocumented Matlab
UPD:不幸的是,虽然有一些 TAB 完成 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.
如果有关于该主题的最新信息(至少,我没有找到任何信息),这是值得怀疑的。
因此,很可能在当前版本中无法在 MatLab 中自动完成点属性和方法,而无需将它们全部静态添加到 *.XML 文件中。
希望对您有所帮助!
关于matlab - Matlab 中自定义类方法的 Tab 补全,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19931996/