This repository was archived by the owner on Nov 22, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathwritemat.m
More file actions
50 lines (37 loc) · 1.37 KB
/
writemat.m
File metadata and controls
50 lines (37 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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,'\n\n');
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
% ----------------------------------------------------------------------