f



Call Matlab m-file from Matlab Scrip Node

My problem with matlab script node is related to calling function in matlab.  I created an m-file function that takes an imput temperature (from DAQ) and defines a material property.  My matlab script node doesn't seem to recognize my function.  I have placed the function in the folder the vi is currently located, but it doesn't read it.  How do I get matlab script node to read the functions I create in matlab?
0
x9561 (148439)
7/9/2008 5:40:05 AM
comp.lang.labview 35210 articles. 1 followers. vasusachin24 (1) is leader. Post Follow

4 Replies
2163 Views

Similar Articles

[PageSpeed] 15

Add the directory to matlab path, or call the .m file with it full name ( D:\..... \myfile.m)
0
x9561 (148439)
7/9/2008 6:40:04 AM
Let me clarify,
 
I have pasted my matlab code into the matlab scrip node.
 
In this code, I have called a subfunction that I have created.
 
Example
k(n)=k_c(T(n))
where
k_c is a subfunction I have created.
 
How do I get my code in the node to sucessfully read the subfunction k_c?
 
 
 
0
x9561 (148439)
7/9/2008 5:10:05 PM
As indicated, you need to add the directory where the .m file containing the function resides to the list of paths that are read in. This is your startup.m file. The other option is to do a "cd" command prior to calling your function to change to the directory where the .m file  containing the function resides.
0
x9561 (148439)
7/9/2008 5:10:08 PM
Thanks for reiterating the information.  My matlab script node is working properly.  I had never used the "cd" command in matlab.  I always set the working directory when I open the program, and put all the m files into that folder.
0
x9561 (148439)
7/10/2008 4:40:05 PM
Reply: