From: Zanie on
Hi...

i am trying to train the network but the following error is occuring:

Error in ==> network.sim>simargs at 236
switch class(P)

??? Output argument "Pi" (and maybe others)
not assigned during call to "C:\Program
Files\MATLAB\R2008b\toolbox\nnet\nnet\@network\sim.m>simargs".

Error in ==> network.sim at 173
case 2, [err,X,Xi,Ai,T,Q,TS,matrixForm] =
simargs(net,X);

Error in ==> createNn at 18
y= sim(net, input);

Error in ==> applyNn at 28
ab= createNn(input1);
-------------------------------------------------------------
The file applyNn.m is:

img= imread('image.bmp');
if size(img,3)==3
img=rgb2gray(img);
end

threshold = graythresh(img);
img =~im2bw(img,threshold);
input1=img(:,:,1);
ab= createNn(input1);

createNn.m :

function y = createNn(input)

ff=[0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1]

alphabet=sampleForTrain;

net= newp(ff,10,'hardlim', 'learnp');
net = train(net, input,alphabet);
y= sim(net, input);

sampleForTrain():

function alphabet=sampleForTrain()

alphabet=[ 0 0 0 0 0 0 0 0 0 0
0 0 1 1 1 1 1 1 0 0
0 0 1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 1 1 1 1 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0]


What am i doing wrong please guide me and suggest me the right path to do.

Thanx in advance.
From: Dario on
"Zanie " <zanie_sweet(a)hotmail.com> wrote in message <hlhfkv$51r$1(a)fred.mathworks.com>...
> Hi...
>
> i am trying to train the network but the following error is occuring:
>
> Error in ==> network.sim>simargs at 236
> switch class(P)
>
> ??? Output argument "Pi" (and maybe others)
> not assigned during call to "C:\Program
> Files\MATLAB\R2008b\toolbox\nnet\nnet\@network\sim.m>simargs".
>
> Error in ==> network.sim at 173
> case 2, [err,X,Xi,Ai,T,Q,TS,matrixForm] =
> simargs(net,X);
>
> Error in ==> createNn at 18
> y= sim(net, input);
>
> Error in ==> applyNn at 28
> ab= createNn(input1);
> -------------------------------------------------------------
> The file applyNn.m is:
>
> img= imread('image.bmp');
> if size(img,3)==3
> img=rgb2gray(img);
> end
>
> threshold = graythresh(img);
> img =~im2bw(img,threshold);
> input1=img(:,:,1);
> ab= createNn(input1);
>
> createNn.m :
>
> function y = createNn(input)
>
> ff=[0 1
> 0 1
> 0 1
> 0 1
> 0 1
> 0 1
> 0 1
> 0 1
> 0 1
> 0 1]
>
> alphabet=sampleForTrain;
>
> net= newp(ff,10,'hardlim', 'learnp');
> net = train(net, input,alphabet);
> y= sim(net, input);
>
> sampleForTrain():
>
> function alphabet=sampleForTrain()
>
> alphabet=[ 0 0 0 0 0 0 0 0 0 0
> 0 0 1 1 1 1 1 1 0 0
> 0 0 1 0 0 0 0 0 0 0
> 0 0 1 0 0 0 0 0 0 0
> 0 0 1 0 0 0 0 0 0 0
> 0 0 1 1 1 1 0 0 0 0
> 0 0 1 0 0 0 0 0 0 0
> 0 0 1 0 0 0 0 0 0 0
> 0 0 1 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0]
>
>
> What am i doing wrong please guide me and suggest me the right path to do.
>
> Thanx in advance.

Hi

I found the same error message and in my case the problem was that the ANN was trained using double precision data and applied to single precision data. Converting the input data for the application in double the problem has been solved. I don't know if it is your case however maybe it could help..

Dario