0001 function write_descrip(obj, fname)
0002
0003
0004
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
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