diff options
| author | Author Name <[email protected]> | 2023-07-07 12:20:59 +0930 |
|---|---|---|
| committer | David Rowe <[email protected]> | 2023-07-07 12:29:06 +0930 |
| commit | ac7c48b4dee99d4c772f133d70d8d1b38262fcd2 (patch) | |
| tree | a2d0ace57a9c0e2e5b611c4987f6fed1b38b81e7 /octave/save_array_c_header.m | |
shallow zip-file copy from codec2 e9d726bf20
Diffstat (limited to 'octave/save_array_c_header.m')
| -rw-r--r-- | octave/save_array_c_header.m | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/octave/save_array_c_header.m b/octave/save_array_c_header.m new file mode 100644 index 0000000..1fd87bb --- /dev/null +++ b/octave/save_array_c_header.m @@ -0,0 +1,14 @@ +% 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 float %s[]={\n", array_name); + for m=1:length(array)-1 + fprintf(f," % .16f,\n",array(m)); + endfor + fprintf(f," % .16f\n};\n",array(length(array))); + fclose(f); +endfunction |
