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
|
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
|
+
+
+
-
+
-
+
|
function write_matrix(matrix,name);
% Writes the matrix function file
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2 1996/08/14 08:36:52 peter
% %% Puts a tab between columns.
% %%
% %% Revision 1.1 1996/08/14 08:21:27 peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
filename = [name, '.m'];
filenum = fopen(filename,'w');
% Write the function m-file for the causal bond graph
pc = '%';
fprintf(filenum, 'function data = %s\n', name);
fprintf(filenum, '%s m = %s\n\n', pc, name);
fprintf(filenum, '%s data = %s\n\n', pc, name);
fprintf(filename, 'm = [\n');
fprintf(filename, 'data = [\n');
[N,M] = size(matrix);
for i = 1:N,
for j = 1:M
fprintf(filename, '%g', matrix(i,j));
if j<M
fprintf(filename, '\t');
|