savetext.m 382 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
function savetext(fname,format,values,header)
%SAVETEXT(FILENAME,FORMAT,VALUES,HEADER) saves matrix in user defined format
%
%	FORMAT should describe one row of the matrix
%	HEADER (optional) is a string printed before the values

fid=fopen(fname,'w');
if (nargin >= 4),if isstr(header)
   for s=header', fprintf(fid,'%s\n',s); end
end,end
fprintf(fid,format,values');
fclose(fid);