% method of class @
%	function writetofile(sig,name) 
%   INPUT VALUES:
%  		sig: signal to save
%		name: filename
%   RETURN VALUE:
%		none
%
% (c) 2003-2008, University of Cambridge, Medical Research Council 
% Maintained by Tom Walters (tcw24@cam.ac.uk), written by Stefan Bleeck (stefan@bleeck.de)
% http://www.pdn.cam.ac.uk/cnbh/aim2006
% $Date: 2008-06-10 18:00:16 +0100 (Tue, 10 Jun 2008) $
% $Revision: 585 $

function writetofile(sig,name)
%usage: writetofile(sig,name)
%DRRSmith 28/05/02
%readsounddata=getdata(sig);
%fid=fopen(name,'wb');
%fwrite(fid,readsounddata,'int16');
%fclose(fid);

if nargin<3

readsounddata=getdata(sig);
if (isunix==1)
   fid=fopen(name,'wb','b'); %bigendian
   fwrite(fid,readsounddata,'int16');
   fclose(fid);
else
   fid=fopen(name,'wb','l'); %littleendian
   fwrite(fid,readsounddata,'int16');
   fclose(fid);
end

% readsounddata=getdata(sig);
% fid=fopen(name,'wb',endian);
% fwrite(fid,readsounddata,'int16');
% fclose(fid);
