Home > phiwave > @phiw_wvimg > write_descrip.m

write_descrip

PURPOSE ^

writes description text file for object to fname

SYNOPSIS ^

function write_descrip(obj, fname)

DESCRIPTION ^

 writes description text file for object to fname 

 $Id: write_descrip.m,v 1.2 2005/06/05 04:42:22 matthewbrett Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function write_descrip(obj, fname)
0002 % writes description text file for object to fname
0003 %
0004 % $Id: write_descrip.m,v 1.2 2005/06/05 04:42:22 matthewbrett Exp $
0005 
0006 if nargin < 2
0007   fname = obj.wvol.fname;
0008 end
0009 if isstruct(fname)
0010   fname = fname.fname;
0011 end
0012 if isempty(fname)
0013   error('Could not find a filename');
0014 end
0015 
0016 % add descrip.txt to .img/hdr fnames
0017 [p f e] = fileparts(fname);
0018 if any(strcmp(e, {'.img','.hdr'}))
0019   fname = fullfile(p, [f '_descrip.txt']);
0020 end
0021 
0022 d = cellstr(obj.descrip);
0023 if ~isempty(d)
0024   fid = fopen(fname,'wt');
0025   if fid ~= -1
0026     fprintf(fid,'%s\n',d{:});
0027     fclose(fid);
0028   end
0029 end

Generated on Wed 06-Jul-2005 18:07:21 by m2html © 2003