Reputation: 1408
I have a simple function about neural network. This function gets a matrix, loads mat file and runs a neural network function with this parameter. In matlab console this is working perfectly. But in C# gives error;
... MWMCR::EvaluateFunction error ...
Subscript indices must either be real positive integers or logicals.
Error in => neural.m at line 4.
... Matlab M-code Stack Trace ...
at file c:\xxxxxxxxxxxx\NeuralClass\neural.m, name neural, line 4.
This is my simple function;
function result=neural(x1)
load('fonksiyon.mat', 'net')
x1=x1';
result= net(x1);
Upvotes: 1
Views: 483
Reputation: 1408
Sim is not working with .net assembly. This helped me;
function result=neural(P)
load('c:\function.mat', 'net');
IW = net.IW{1};
b1 = net.b{1};
LW = net.LW{2};
b2 = net.b{2};
P=P';
y1 = satlin (IW * P + b1 );
y2 = tansig (LW * y1 + b2 );
result= y2;
Upvotes: 2