1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
function write_matrix(matrix,name);
% Writes the matrix function file
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.4 1996/08/15 11:56:11 peter
% %% Does complex matrices.
% %%
% %% Revision 1.3 1996/08/14 19:20:41 peter
% %% Fixed output naming bug.
% %%
% %% Revision 1.2 1996/08/14 08:36:52 peter
|
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
function write_matrix(matrix,name);
% Writes the matrix function file
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.5 1998/02/03 08:40:39 peterg
% %% Fixed a horrible bug -- changed filename -> filenum
% %%
% %% Revision 1.4 1996/08/15 11:56:11 peter
% %% Does complex matrices.
% %%
% %% Revision 1.3 1996/08/14 19:20:41 peter
% %% Fixed output naming bug.
% %%
% %% Revision 1.2 1996/08/14 08:36:52 peter
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
fprintf(filenum, '%s data = %s\n\n', pc, name);
fprintf(filenum, '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(filenum, '%g', re);
if im ~= 0
fprintf(filenum, '+ %g*i', im);
end
if col<M
fprintf(filenum, '\t');
end
end;
fprintf(filenum, '\n');
end;
|
|
<
|
|
|
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
fprintf(filenum, '%s data = %s\n\n', pc, name);
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;
|