1 function UDXappend2Ddata(filename,p,t,u,attr_name,attr_rank,attr_shape,endfile)
4 % UDXappend2Ddata(filename,p,t,u,attr_name,attr_rank,attr_shape)
6 % Apends data to a file in DX form.
7 % Only one variable can be written to the file
8 % variable must be a scalar, vector or tensor of doubles
9 % mesh data in the file must be consistent with this variable
12 % attr_name = name of the variable (type string)
13 % attr_rank = rank of variable data (0 for scalar, 1 for vector, etc.)
14 % attr_shape = number of components of variable data (assumed 1 for scalar)
21 %eval(['!rm -f ',filename]);
23 fid=fopen (filename,'a');
25 Ntriangoli = size(t,1);
27 fprintf(fid,'\nattribute "element type" string "triangles"\nattribute "ref" string "positions"\n\n');
29 if ((attr_rank==0) & (min(size(u))==1))
30 fprintf(fid,'object "%s.data"\nclass array type double rank 0 items %d data follows',attr_name,Nnodi);
31 fprintf(fid,'\n %1.7e',u);
33 fprintf(fid,'object "%s.data"\nclass array type double rank %d shape %d items %d data follows', ...
34 attr_name,attr_rank,attr_shape,Nnodi);
37 fprintf(fid,' %1.7e',u(i,:));
40 fprintf(fid,['\nattribute "dep" string "positions"\n\n' ...
41 'object "%s" class field\n'...
42 'component "positions" value "pos"\n'...
43 'component "connections" value "con"\n'...
44 'component "data" value "%s.data"\n'],...
48 fprintf(fid,'\nend\n');
56 % $Date: 2007-05-22 21:16:23 +0200 (tir, 22 maj 2007) $