简体   繁体   English

如何调用另一个程序MATLAB中的函数

[英]How to call a function which is in another program MATLAB

I write this in my main programm 我在我的主程序中写这个

[C,rows,cols,entries] = Matrix('C.txt')

Matrix fuction is in another program Matrix.m and I want to call it. Matrix函数在另一个程序Matrix.m中,我想调用它。

I get this error : 我收到此错误:

Undefined function or variable 'Matrix'.

Error in (line 19)

[C,rows,cols,entries] = Matrix'C.txt')

Can you please tell me how to fix it ? 你能告诉我怎么解决吗?

It is possible that your file and function are not in the same folder. 您的文件和功能可能不在同一文件夹中。 If you do not want the file and function in the same folder, you can use addpath to add search path of your function path or folder. 如果您不希望文件和功能位于同一文件夹中,则可以使用addpath添加功能路径或文件夹的搜索路径。

( https://www.mathworks.com/help/matlab/ref/addpath.html ) https://www.mathworks.com/help/matlab/ref/addpath.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM