![](/img/trans.png)
[英]Matlab how to call function m.file from callback function that locate in another m file?
[英]How to call member function of class in another m file in matlab?
如何調用類函數,並在另一個 file.m 中初始化類的對象,當從命令窗口調用它的工作時,但我想從 m 文件調用函數。
我有文件夾:@myClassName。
如果您在函數中聲明對象,則必須返回函數的輸出參數,您可以在工作區中看到結果
既然你說它在命令窗口中工作,那么問題很可能是路徑。 包含類文件夾 @myClassName 的文件夾必須在路徑中(請參閱函數addpath
)。 從另一個文件中,您只需要:
my_instance = myClassName(...) % ... represent the inputs to your constructor.
my_instance.MyFunction(...);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.