LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview call second order user defined .m files error 1050

Hi guys,

 

I has Labview matlab script problem with error 1050:

 

My labview can run matlab script example: Lorenze Diff Eq.vi very well and run matlab its own functions;

I had a user defined function called reverse.m files ( it is used to reverse a vector like a (1 2 3 4 5 6)-->(6 5 4 3 2 1))


function r = reverse(x)
r = x(length(x):-1:1);

I can call this user defined function in Matalb script. no error!

 

I had another user defined function called reversecal.m files (it is used to reverse a matrix

 like(1 2 3 4 5 6; 7 8 9 10 11 12;)--> (6 5 4 3 2 1;12 11 10 9 8 7;))

function rcal=reversecal(cal)


[rX,cX] = size(cal);

 

for i=1:rX

rcal(i,:)=reverse(cal(i,:));


end

 
when I called this reversecal.m files, it always has an error  1050: Undefined function or method 'reversecal' for input arguments of type 'double'.

 

Also very frequently I have this error 1050 for my user defined .m files: Undefined function or method 'xxx' for input arguments of type 'double';

 

I searched a lot in google and NI forum and still can not figure out what is wrong with this errror1050!

 

ask for help ! thank you so much!!!!

Download All
0 Kudos
Message 1 of 4
(3,447 Views)

By the way, both these two files work in the matlab interface.

0 Kudos
Message 2 of 4
(3,446 Views)

You need to specify the working directory in your Matlab script node. Unless the .m file is in one of the directories that is in the Matlab search path then it won't find the function. The reason why it works in Matlab is probably because you do a "cd" in Matlab or you change the directory from the dropdown at the top of the window, which amounts to the same thing.

0 Kudos
Message 3 of 4
(3,431 Views)

Hi smercuio_fc,

 

both of the two function are in the same files.

 

I put path(path, newpath) infront of that two commands, right now it works.

 

Thank you so much!

 

 

0 Kudos
Message 4 of 4
(3,422 Views)