0001 function [ cl ] = loadFromFid( dummy, fid )
0002
0003
0004
0005
0006
0007
0008
0009
0010 [numClasses, count] = fread(fid, 1, 'uint16');
0011 if count <= 0
0012 error('Error reading from file\n');
0013 end
0014
0015
0016
0017
0018 [clSize, count] = fread(fid, 1, 'uint16');
0019
0020 if count <= 0
0021 error('Error reading from file\n');
0022 end
0023
0024
0025 [clobj, count] = fread(fid, clSize, '*uint8');
0026
0027 if count <= 0
0028 error('Error reading from file\n');
0029 end
0030
0031 cl.trainedSVM = deserialize(clobj);
0032
0033 if isstruct(cl.trainedSVM)
0034
0035 cl.trainedSVM.SVs = sparse(cl.trainedSVM.SVs);
0036 end
0037
0038
0039
0040
0041 [datasize, count] = fread(fid, 1, 'uint16');
0042
0043 if count <= 0
0044 error('Error reading from file\n');
0045 end
0046
0047
0048 [data, count] = fread(fid, datasize, '*uint8');
0049
0050 if count <= 0
0051 error('Error reading from file\n');
0052 end
0053
0054 cl.libSvmTrnOpts = deserialize(data);
0055
0056
0057
0058 [datasize, count] = fread(fid, 1, 'uint16');
0059
0060 if count <= 0
0061 error('Error reading from file\n');
0062 end
0063
0064
0065 [data, count] = fread(fid, datasize, '*uint8');
0066
0067 if count <= 0
0068 error('Error reading from file\n');
0069 end
0070
0071 cl.libSvmPrdOpts = deserialize(data);
0072
0073
0074 cl = class(cl, 'SVMClassifier', Classifier(numClasses));
0075 end