Matlab Help Index Technical Documentation Index

fast_write_wfile

NAME ^

SYNOPSIS ^

function [w] = fast_write_wfile(fname, w)

DESCRIPTION ^

 [w] = fast_write_wfile(fname, w)
 writes a vector into a binary 'w' file
  fname - name of file to write to
  w     - vector of values to be written

CROSS-REFERENCE INFORMATION ^

This function calls:

This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001  function [w] = fast_write_wfile(fname, w)
0002  %
0003  % [w] = fast_write_wfile(fname, w)
0004  % writes a vector into a binary 'w' file
0005  %  fname - name of file to write to
0006  %  w     - vector of values to be written
0007  %
0008 
0009  if(nargin ~= 2)
0010    fprintf('USAGE: [w] = fast_write_wfile(fname, w) \n');
0011    return;
0012  end
0013 
0014  % open it as a big-endian file
0015  fid = fopen(fname, 'wb', 'b') ;
0016 if (fid<0)
0017     oops(158);
0018 end
0019 
0020  vnum = length(w) ;
0021 
0022  fwrite(fid, 0, 'int16') ;
0023  fwrite3(fid, vnum) ;
0024  for i=1:vnum
0025    fwrite3(fid, i-1) ;
0026    wt = w(i) ;
0027    fwrite(fid, wt, 'float') ;
0028  end
0029 
0030  fclose(fid) ;
0031 
0032  return
0033

Generated at 19:47:41 15-Oct-2003 by m2html © 2003