femwind_rate_test and femwind_run_fortran_rate_test both exiting in iteration 20...
[wrf-fire-matlab.git] / femwind / write_array.m
blobdc08492d987338fcb081d1f901bfd11a4eab7202
1 function write_array(a,name)
2 % write_array(a,name)
3 % matrix a to a given file name.txt
4 if ndims(a)>3,
5     error('array must have at most 3 dimensions')
6 end
7 filename=[name,'.txt'];
8 X=zeros(5,1);
9 X(1)=456; % magic number
10 X(2)=3;
11 X(3)=size(a,1);
12 X(4)=size(a,2);
13 X(5)=size(a,3);
14 X=[X;a(:)];
15 fprintf('writing matrix size %g %g %g to file %s\n',...
16     X(3:5),filename)
17 h=fopen(filename,'w');
18 fprintf(h,'%.17g\n',X);
19 fclose(h);