Overview
Comment:Does complex matrices.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 07a11bc45d7454055c6d8704e21ac05634dc71a73e73405f44b6e6967f5364bd
User & Date: gawthrop@users.sourceforge.net on 1996-08-15 11:56:11
Other Links: branch diff | manifest | tags
Context
1996-08-15
11:56:38
Initial revision check-in: 04b7f16b2a user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:56:11
Does complex matrices. check-in: 07a11bc45d user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:55:30
Checks for changed argument.
Handles frequency response.
check-in: 6b06951768 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/write_matrix.m from [9cd61e8818] to [140a590016].

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
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 data = %s\n\n', pc, name);

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');
    end
  end;
  fprintf(filename, '\n');
end;

fprintf(filename, '];\n');
fprintf(filename, '\n');

fclose(filenum);











>
>
>




















|
|
>
>
|
>
>
>
|












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
51
52
53
function write_matrix(matrix,name);

% Writes the matrix function file

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1996/08/14 19:20:41  peter
% %% Fixed output naming bug.
% %%
% %% 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 data = %s\n\n', pc, name);

fprintf(filename, 'data = [\n');

[N,M] = size(matrix);
for row = 1:N
  for col = 1:M
    re = real(matrix(row,col));
    im = imag(matrix(row,col));
    fprintf(filename, '%g', re);
    if im ~= 0
      fprintf(filename, '+ %g*i', im);
    end
    if col<M
      fprintf(filename, '\t');
    end
  end;
  fprintf(filename, '\n');
end;

fprintf(filename, '];\n');
fprintf(filename, '\n');

fclose(filenum);



MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]