Overview
Comment:Write complex numbers in polar form instead of real and imaginary parts.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 6f576ace04c17491805077859a392b8139308a6fa169a465a77b836373e14800
User & Date: geraint@users.sourceforge.net on 2006-09-27 13:55:08
Other Links: branch diff | manifest | tags
Context
2008-07-22
17:37:01
Fixed case of MTT_EXAMPLES check-in: ece2886999 user: geraint@users.sourceforge.net tags: origin/master, trunk
2006-09-27
13:55:08
Write complex numbers in polar form instead of real and imaginary parts. check-in: 6f576ace04 user: geraint@users.sourceforge.net tags: origin/master, trunk
13:03:20
Fixed fr.view and enabled commands to directly build ??fr.m check-in: 1c537610b2 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/write_matrix.m from [969955d3a1] to [16a127a42d].

1
2
3
4
5
6
7
8
9



10
11
12
13
14
15
16
function write_matrix(matrix,name,extn);

% Writes the matrix function file

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$



% %% Revision 1.7  2002/05/15 16:37:30  gawthrop
% %% Added third argument (file extension)
% %%
% %% Revision 1.6  2000/12/27 16:06:17  peterg
% %% *** empty log message ***
% %%
% %% Revision 1.5  1998/02/03 08:40:39  peterg









>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function write_matrix(matrix,name,extn);

% Writes the matrix function file

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.8  2004/09/12 22:27:27  geraint
% %% Appended 't' to fopen mode string to open in text mode.
% %%
% %% Revision 1.7  2002/05/15 16:37:30  gawthrop
% %% Added third argument (file extension)
% %%
% %% Revision 1.6  2000/12/27 16:06:17  peterg
% %% *** empty log message ***
% %%
% %% Revision 1.5  1998/02/03 08:40:39  peterg
45
46
47
48
49
50
51
52
53


54
55
56
57
58
59
60
61

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

[N,M] = size(matrix);
for row = 1:N
  for col = 1:M
    value = matrix(row,col);
    fprintf(filenum, '%g', real(value));
    if is_complex(value)


      fprintf(filenum, '+ %g*i', imag(value));
    end
    if col<M
      fprintf(filenum, '\t');
    end
  end;
  fprintf(filenum, '\n');
end;







<

>
>
|







48
49
50
51
52
53
54

55
56
57
58
59
60
61
62
63
64
65

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

[N,M] = size(matrix);
for row = 1:N
  for col = 1:M
    value = matrix(row,col);

    if is_complex(value)
	fprintf(filenum, '%g*e^(%g*i)', abs(value),angle(value));
    else
	fprintf(filenum, '%g', value);
    end
    if col<M
      fprintf(filenum, '\t');
    end
  end;
  fprintf(filenum, '\n');
end;


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