0001 function saveToFid( cl, fid )
0002
0003
0004
0005
0006
0007
0008 if fwrite(fid, getNumClasses(cl), 'uint16') ~= 1
0009 error('Error writing to file\n');
0010 end
0011
0012
0013
0014
0015
0016 if isstruct(cl.trainedSVM)
0017 cl.trainedSVM.SVs = full(cl.trainedSVM.SVs);
0018 end
0019
0020 data = serialize(cl.trainedSVM);
0021 dataSize = size(data, 1);
0022
0023
0024 if fwrite(fid, dataSize, 'uint16') ~= 1
0025 error('Error writing to file\n');
0026 end
0027
0028
0029 if fwrite(fid, data, 'uint8') ~= dataSize
0030 error('Error writing to file\n');
0031 end
0032
0033
0034
0035 data = serialize(cl.libSvmTrnOpts);
0036 dataSize = size(data, 1);
0037
0038
0039 if fwrite(fid, uint16(dataSize), 'uint16') ~= 1
0040 error('Error writing to file\n');
0041 end
0042
0043
0044 if fwrite(fid, data, 'uint8') ~= dataSize
0045 error('Error writing to file\n');
0046 end
0047
0048
0049
0050 data = serialize(cl.libSvmPrdOpts);
0051 dataSize = size(data, 1);
0052
0053
0054 if fwrite(fid, uint16(dataSize), 'uint16') ~= 1
0055 error('Error writing to file\n');
0056 end
0057
0058
0059 if fwrite(fid, data, 'uint8') ~= dataSize
0060 error('Error writing to file\n');
0061 end
0062
0063
0064 end
0065