1function saveNetwork(net)
2% Save the
file 'network.ini' containing the network
'net'
3% in the proper format required by the ctrlLib framework.
5% Copyright: (C) 2010 RobotCub Consortium
7% CopyPolicy: Released under the terms of the GNU GPL v2.0.
9fid=fopen(
'network.ini',
'w');
20fprintf(fid,
'// hidden layer neurons\n');
22 fprintf(fid,'IW_%d\t\t( ',uint8(i-1));
24 fprintf(fid,'%.15
f ',net.IW{1}(i,j));
30fprintf(fid,
'// output layer neurons\n');
32 fprintf(fid,'LW_%d\t\t( ',uint8(i-1));
34 fprintf(fid,'%.15
f ',net.LW{2,1}(i,j));
40fprintf(fid,
'// bias hidden layer neurons\n');
42for i=1:length(net.b{1})
47fprintf(fid,
'// bias output layer neurons\n');
49for i=1:length(net.b{2})
54fprintf(fid,
'// input preprocessing\n');
55params=net.inputs{1}.processSettings{end};
57 fprintf(fid,'inMinMaxX_%d\t\t( %.15
f %.15
f )\
n',uint8(i-1),params.xmin(i),params.xmax(i));
60 fprintf(fid,'inMinMaxY_%d\t\t( %.15
f %.15
f )\
n',uint8(i-1),params.ymin,params.ymax);
65params=net.outputs{2}.processSettings{end};
67 fprintf(fid,'outMinMaxY_%d\t\t( %.15
f %.15
f )\
n',uint8(i-1),params.ymin,params.ymax);
70 fprintf(fid,'outMinMaxX_%d\t\t( %.15
f %.15
f )\
n',uint8(i-1),params.xmin(i),params.xmax(i));
function saveNetwork(net) % Save the file 'network.ini' containing the network 'net' % in the proper format required by the ctrlLib framework. % % Copyright szIW