ADDED mttroot/mtt/lib/control/PPP/ppp_ustar2h.m Index: mttroot/mtt/lib/control/PPP/ppp_ustar2h.m ================================================================== --- /dev/null +++ mttroot/mtt/lib/control/PPP/ppp_ustar2h.m @@ -0,0 +1,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