www.pudn.com > LPCToolbox.rar > RAWREAD.M
% RAWREAD
% [data,count] = rawread(fname, fmt)
% fname: filename to read
% fmt : type of each data item (default: 'int16')
%
function [out,count] = rawread(fname,fmt)
if (nargin == 1)
fmt = 'int16';
end
out = []; count = 0;
[fp,mesg]=fopen(fname,'r');
if (~isempty(mesg))
fprintf(1, 'rawread (%s): %s\n', fname, mesg);
return;
end
[out,count]=fread(fp,inf,fmt);
status=fclose(fp);
if (status ~= 0)
error(['rawread: problem closing ' fname]);
end