1 function 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
6 % Author: Ugo Pattacini
7 % CopyPolicy: Released under the terms of the GNU GPL v2.0.
9 fid=fopen(
'network.ini',
'w');
20 fprintf(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));
30 fprintf(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));
40 fprintf(fid,
'// bias hidden layer neurons\n');
42 for i=1:length(net.b{1})
47 fprintf(fid,
'// bias output layer neurons\n');
49 for i=1:length(net.b{2})
54 fprintf(fid,
'// input preprocessing\n');
55 params=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);
65 params=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