MATLAB: Hidden layer activations with Neural Network Toolbox

autoencoderhidden layerneural network

Hello,
I have recently started using Matlab's Neural Network Toolbox, after some years of working with Netlab. Does anybody know how to get the activations (=output of the transfer function) of the hidden layers?
So if I create a 4-2-4 network:
net = feedforwardnet(2,'trainlm');
net = configure(net,randn(4,10),randn(4,10));
inp = randn(4,1);
out = sim(net, inp);
How can I then find the output of the hidden layer?
Regards,
Martijn

Best Answer

The easiest way to obtain the hidden layer output of a I-H-O net is to just use the weights to create a net with no hidden layer with topology I-H.
Hope this helps.
Thank you for formally accepting my answer
Greg