LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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 Kudos
Message 1 of 5
(7,750 Views)
Add the directory to matlab path, or call the .m file with it full name ( D:\..... \myfile.m)
_________________________________________________________________________________________________
LV 8.2 at Windows & Linux


0 Kudos
Message 2 of 5
(7,747 Views)
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 Kudos
Message 3 of 5
(7,720 Views)
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 Kudos
Message 4 of 5
(7,713 Views)
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 Kudos
Message 5 of 5
(7,690 Views)