WRITEMAT.M
资源名称:easy.zip [点击查看]
上传用户:sfyaiting
上传日期:2009-10-25
资源大小:320k
文件大小:1k
源码类别:
GPS编程
开发平台:
Matlab
- function writemat (fid,text,matrix,format)
- %WRITEMAT: Write the contents of a matrix to a file
- %
- % Input arguments:
- % fid: File identifier:
- % 0: Do not write at all
- % 1: Write to screen (matlab default output)
- % n: Write to file 'n', which should be be open
- % text : Descriptive text
- % matrix: The matrix to be printed
- % format: Format to be used, optional, default = "%15.5f"
- % ----------------------------------------------------------------------
- % File.....: writemat.m
- % Date.....: 19-MAR-1999
- % Author...: Peter Joosten
- % Mathematical Geodesy and Positioning
- % Delft University of Technology
- % ----------------------------------------------------------------------
- if nargin < 4; format = '%15.5f'; end;
- if fid ~= 0;
- fprintf (fid,'%c',[text ':']);
- fprintf (fid,'nn');
- for i = 1:size(matrix,1);
- for j = 1:size(matrix,2);
- if size(format,1) < size (matrix,2);
- fprintf (fid,format(1,:),matrix(i,j));
- else;
- fprintf (fid,format(j,:),matrix(i,j));
- end;
- end;
- fprintf (fid,'n');
- end;
- fprintf (fid,'n');
- end;
- % ----------------------------------------------------------------------
- % End of routine: writemat
- % ----------------------------------------------------------------------