Matlab Help Index Technical Documentation Index

read_wfile

NAME ^

SYNOPSIS ^

function [w,v] = read_wfile(fname)

DESCRIPTION ^

 [w,v] = read_wfile(fname)
 reads a vector into a binary 'w' file
                fname - name of file to write to
                w     - vector of values to be written
                v     - vector of vertex indices

CROSS-REFERENCE INFORMATION ^

This function calls:

This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [w,v] = read_wfile(fname)
0002 
0003 %
0004 % [w,v] = read_wfile(fname)
0005 % reads a vector into a binary 'w' file
0006 %                fname - name of file to write to
0007 %                w     - vector of values to be written
0008 %                v     - vector of vertex indices
0009 %
0010 
0011 
0012 % open it as a big-endian file
0013 fid = fopen(fname, 'rb', 'b') ;
0014 if (fid < 0)
0015      %%str = sprintf('could not open w file %s.', fname) ;
0016      %%error(str) ;
0017     oops(159);
0018 end
0019 %vnum = length(w) ;
0020 
0021 fread(fid, 1, 'int16') ;
0022 vnum = fread3(fid) ;
0023 w = zeros(vnum,1) ;
0024 v = zeros(vnum,1) ;
0025 for i=1:vnum
0026                 v(i) = fread3(fid) ;
0027                 w(i) = fread(fid, 1, 'float') ;
0028 end
0029 
0030 fclose(fid) ;
0031 
0032 
0033 
0034 
0035 
0036

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