function pl(samplename, start_sam, end_sam, pngname) fs=fopen(samplename,"rb"); s=fread(fs,Inf,"short"); st = 1; en = length(s); if (nargin >= 2) st = start_sam; endif if (nargin >= 3) en = end_sam; endif figure(1); plot(s(st:en)); axis([1 en-st min(s) max(s)]); if (nargin == 4) % small image __gnuplot_set__ terminal png size 420,300 s = sprintf("__gnuplot_set__ output \"%s.png\"", pngname); eval(s) replot; % larger image __gnuplot_set__ terminal png size 800,600 s = sprintf("__gnuplot_set__ output \"%s_large.png\"", pngname); eval(s) replot; endif endfunction