Overview
Comment:Covenverst U* to a c-header file
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 358cf702402112a70217172dc3036d1ef02695eeeb89dabf411106c5a41182e3
User & Date: gawthrop@users.sourceforge.net on 2003-08-19 16:19:53
Other Links: branch diff | manifest | tags
Context
2003-08-19
16:20:33
More sanity checks check-in: 9e64008a9c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:19:53
Covenverst U* to a c-header file check-in: 358cf70240 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:16:15
Updated for new MTT check-in: f9751a5761 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/lib/control/PPP/ppp_ustar2h.m version [07b58f747a].





























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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 ppp_ustar2h (Ustar,name)

  ## usage:  ppp_Ustar2h (Ustar[,name])
  ##
  ## 

  if nargin<2
    name = "Ustar";
  endif

  [N,N_U] = size(Ustar);

  ## Open the file 
  filename = sprintf("%s.h", name);
  fid = fopen(filename,"w");

  ## Header
  header = sprintf("/*\n File %s generated by ppp_ustar2h on %s */\n", \
		   filename, ctime(time));

  def = sprintf("#define N_U %i\n#define N_T %i\n", N_U, N);

  fprintf(fid, "%s%sdouble %s[N_T][N_U] = {\n",header,def,name);
  for i=1:N
    fprintf(fid, "{");
    for j=1:N_U
      if j<N_U
	comma = ",";
      else
	comma = "";
      endif
      fprintf(fid, "%g%s ", Ustar(i,j),comma);
    endfor

    if i<N
      fprintf(fid, "},\n");
    else
      fprintf(fid, "}\n");
    endif
    
  endfor
  fprintf(fid, "};\n");

  fclose(fid);

endfunction


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