% save_array_c_header.m
%
% David Rowe Sep 2015

function save_array_c_header(array, array_name, filename)
  f=fopen(filename,"wt");
  fprintf(f,"/* Generated by save_array_c_header.m Octave function */\n\n");
  fprintf(f,"const int %s[]={\n", array_name);
  for m=1:length(array)-1
    fprintf(f,"  %f,\n",array(m));
  endfor
  fprintf(f,"  %f\n};\n",array(length(array)));
  fclose(f);
endfunction
