Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

how to do comparison on neural network output

Asked by Elysi Cochin on 18 Mar 2013

i have saved 8 outputs of neural netowrk in one matfile "db_net"...

is it possible.... for me to execute one image and check whether its neural network output matches with anyone in the db_net matfile.....

i did like this...

    count = 0;
    load db_net
    for i = 1:8
        if db_net{i} == net;
            count = i;

but i'm getting error as....

    ??? Undefined function or method 'eq' for input arguments of type 'network'.
    Error in ==> MainFile at 140
            if db_net{i} == net;

i think its because of equal to operator.... please can someone show me how to do comparison on neural network output.... please do reply.....


Elysi Cochin on 18 Mar 2013

i observed that the neural network output changes each time it is executed.... is there any output of "net" that remains same every time..... so that i can use that value for comparison...

Greg Heath on 18 Mar 2013

Upon rereading your post I realized that I may not fully understand what you mean.

I thought you were saving trained nets obtained via training followed by the save command

db_net{ kk } = net ;

save db_net;

If so, the nets would be equal if and only if all properties have exactly the same values. Therefore, if the difference of just one component of one weight is not EXACTLY zero, the nets are different.

Is that really what you want?

Or are you saving net outputs y = net(x)? If so, the same comments apply.

Please clarify


Elysi Cochin


No products are associated with this question.

1 Answer

Answer by Greg Heath on 18 Mar 2013
Accepted answer

>> net1 = fitnet;net2=fitnet;isequal(net1,net2)

ans =


Hope this helps.

Thank you for formally accepting my answer


1 Comment

Elysi Cochin on 20 Mar 2013

thank u sir

Greg Heath

Contact us