1

我有一个关于神经网络的简单功能。此函数获取矩阵,加载 mat 文件并使用此参数运行神经网络函数。在 matlab 控制台中,这是完美的。但在 C# 中给出错误;

... 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.

这是我的简单功能;

function  result=neural(x1)
load('fonksiyon.mat', 'net')
x1=x1';
result= net(x1);
4

1 回答 1

2

Sim 不使用 .net 程序集。这对我有帮助;

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;
于 2012-04-08T12:46:54.753 回答