LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling user defined functions in Matlab Script Node

Greetings!

I am not successful in calling a user defined function inside a Matlab Script Node.

The path has been added to Matlab, but the Matlab script node is not calling my function.

I am calling it as follows:

a= fcd(b,c);


and the fcd.m file is calculating the 'first central difference' - works in Matlab, but not in LabVIEW:



function MtxOut=fcd(MtxIn,dt)

%MtxOut=fcd(MtxIn,dt)
%first central difference method of finding instantaneous
%first derivatives
%
%MtxIn = MxN matrix of inputs
%dt = time change between inputs
%MtxOut = MxN matrix of first derivatives of inputs

r=size(MtxIn,1);
c=size(MtxIn,2);

MtxOut(1,:)=(MtxIn(2,:)-MtxIn(1,:))/dt;
MtxOut(r,:)=(MtxIn(r,:)-MtxIn(r-1,:))/dt;
for i=2:r-1
    for j=1:c
        MtxOut(i,j)=(MtxIn(i+1,j)-MtxIn(i-1,j))/(2*dt);
    end
end

0 Kudos
Message 1 of 2
(2,108 Views)

Matthew:

What version of MatLab, LabVIEW are you using?. Also, what type of errors are you running into?.

Thanks,

Rudi N.

0 Kudos
Message 2 of 2
(2,099 Views)