Overview
Comment:Initial revision
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: cd45d5ef5439b3b34a3b5de85d816c35142300c2df0c4f37bffc96ae34a2d537
User & Date: gawthrop@users.sourceforge.net on 1996-12-04 21:53:00
Other Links: branch diff | manifest | tags
Context
1996-12-04
21:53:49
Uses filenum instead of filename. check-in: 208916aa1b user: gawthrop@users.sourceforge.net tags: origin/master, trunk
21:53:00
Initial revision check-in: cd45d5ef54 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
21:52:39
Now uses fopen. check-in: 7a89dd5b54 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/bin/trans/m/mat2mfile.m version [a2ab0a40d1].





























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
function  mat2mfile(matrix, matrix_name, filenum);
% mat2mfile - writes a matrix as part of an  m-file
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  mat2mfile
% mat2mfile(matrix, matrix_name, filenum)

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


% Copyright (c) P.J. Gawthrop, 1996.

%Writes out a matrix as a matlab m-file

[N, M] = size(matrix);

empty = (N==1)&(M==1)&(matrix(1,1)==0);

% $$$  if nargin<3
% $$$   filenum = 'stdout';
% $$$ end;

%Write out the matrix
fprintf(filenum, '%s = [\n', matrix_name);

if ~empty
  for i = 1:N,
    for j = 1:M
      fprintf(filenum, '%1.0f ', matrix(i,j));
    end;
    fprintf(filenum, '\n');
  end;
else
  fprintf(filenum,'0');
end;
fprintf(filenum, '];\n');
fprintf(filenum, '\n');


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