From: drowe67 Date: Tue, 22 Sep 2015 19:34:35 +0000 (+0000) Subject: function for saving arrays as header files X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=c40a334642bc53ecf825a8d647f5df1082192323;p=freetel-svn-tracking.git function for saving arrays as header files git-svn-id: https://svn.code.sf.net/p/freetel/code@2348 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/octave/newamp_fbf.m b/codec2-dev/octave/newamp_fbf.m index 119a5814..891c6541 100644 --- a/codec2-dev/octave/newamp_fbf.m +++ b/codec2-dev/octave/newamp_fbf.m @@ -115,14 +115,13 @@ function newamp_fbf(samname, f) figure(3) subplot(211) plot(Sdb) - hold on; - plot(20*log10(abs(Aw(1:256))),'g') - hold off; + title('Mag (dB)'); subplot(212) plot(phase(1:256)) hold on; - plot(angle(Aw(1:256)),'g') + plot(angle(Aw(1:256))+0.5,'g') hold off; + title('Phase (rads)'); figure(4) plot(s) diff --git a/codec2-dev/octave/save_array_c_header.m b/codec2-dev/octave/save_array_c_header.m new file mode 100644 index 00000000..0a6800d3 --- /dev/null +++ b/codec2-dev/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 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