简体   繁体   中英

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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