1 function [varargout]=read_rec(fid,n,types)
7 begbytes=n*type2len(type);
10 if items ~= n, error('bad number of types'), end
13 ilen(i)=type2len(types{i});
18 bytes=fread(fid,1,'int');
19 if(bytes ~= begbytes),
20 error(sprintf('record length is %i instead of %i',bytes,begbytes))
23 rec=fread(fid,n,type);
26 rec(i)=fread(fid,1,types{i});
29 bytend=fread(fid,1,'int');
31 error(sprintf('end byte count %i instead of %i',bytend,bytes))
41 error(sprintf('record items %i should be %i\n',n,nargout))
46 function len=type2len(type)
47 if strcmp(type,'int'),
49 elseif strcmp(type,'double'),