MATLAB Projects DISCUSSION

How to call a function which is in another program MATLAB

Started by syedzainnasir How to call a function which is in another program MATLAB
2 replies 248 views 2 participants
Latest activity · 06 Mar 2017

How to call a function which is in another program MATLAB

syedzainnasir MATLAB Projects Forum
#1
I write this in my main program [code] [C,rows,cols,entries] = Matrix('C.txt')[/code] Matrix fuction is in another program Matrix.m and I want to call it.

I get this error :
[code]Undefined function or variable 'Matrix'. Error in (line 19) [C,rows,cols,entries] = Matrix'C.txt')[/code] Can you please tell me how to fix it ?

Community replies 2

Re: How to call a function which is in another program MATLAB

#2
You should place your Main file and the function file in the same folder otherwise you can't call function files in the Main File.

Moreover, another thing I just checked is that you are missing the bracket sign in below code: [code][C,rows,cols,entries] = Matrix'C.txt')[/code] So, you should add this small bracket too.

Re: How to call a function which is in another program MATLAB

#3
[quote=theenggprojects post_id=552 time=1489047701 user_id=2] You should place your Main file and the function file in the same folder otherwise you can't call function files in the Main File.

Moreover, another thing I just checked is that you are missing the bracket sign in below code: [code][C,rows,cols,entries] = Matrix'C.txt')[/code] So, you should add this small bracket too. [/quote]
thanks for the code dear
TEP COMMUNITY