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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

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; break; end end

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

*No products are associated with this question.*

Answer by Greg Heath
on 18 Mar 2013

Accepted answer

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

ans =

1

Hope this helps.

**Thank you for formally accepting my answer**

Greg

## 2 Comments

## Elysi Cochin

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/67587#comment_137190

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

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/67587#comment_137226

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

Greg