0001 function saveToFid(cl, fid)
0002
0003
0004
0005
0006
0007
0008
0009
0010 data = serialize(class(cl.weakCl));
0011 dataSize = size(data, 1);
0012
0013
0014 if fwrite(fid, uint16(dataSize), 'uint16') ~= 1
0015 error('Error writing to file\n');
0016 end
0017
0018
0019 if fwrite(fid, data, 'uint8') ~= dataSize
0020 error('Error writing to file\n');
0021 end
0022
0023
0024 if fwrite(fid, cl.errBound, 'double') ~= 1
0025 error('Error writing to file\n');
0026 end
0027
0028 saveToFid(cl.weakCl, fid);
0029
0030
0031 if fwrite(fid, length(cl.trndCls), 'uint16') ~= 1
0032 error('Error writing to file\n');
0033 end
0034
0035
0036 for i = 1:length(cl.trndCls)
0037 saveToFid(cl.trndCls{i}, fid)
0038 end
0039
0040
0041 if fwrite(fid, cl.nStages, 'uint16') ~= 1
0042 error('Error writing to file\n');
0043 end
0044
0045
0046 data = serialize(cl.lastExWeights);
0047 dataSize = size(data, 1);
0048
0049
0050 if fwrite(fid, uint16(dataSize), 'uint16') ~= 1
0051 error('Error writing to file\n');
0052 end
0053
0054
0055 if fwrite(fid, data, 'uint8') ~= dataSize
0056 error('Error writing to file\n');
0057 end
0058
0059 data = serialize(cl.clsWeights);
0060 dataSize = size(data, 1);
0061
0062
0063 if fwrite(fid, uint16(dataSize), 'uint16') ~= 1
0064 error('Error writing to file\n');
0065 end
0066
0067
0068 if fwrite(fid, data, 'uint8') ~= dataSize
0069 error('Error writing to file\n');
0070 end
0071
0072 if fwrite(fid, cl.thresh, 'double') ~= 1,
0073 error('Error writing to file\n');
0074 end
0075
0076 if fwrite(fid, cl.detectionRate, 'double') ~= 1,
0077 error('Error writing to file\n');
0078 end