Attachment 'read_complex_binary.m'

Download

   1 function v = read_complex_binary (filename, count)
   2 
   3   %% usage: read_complex_binary (filename, [count])
   4   %%
   5   %%  open filename and return the contents as a column vector, 
   6   %%  treating them as 32 bit complex numbers
   7   %%
   8 
   9   if (nargin < 2)
  10     count = Inf;
  11   end
  12 
  13   f = fopen (filename, 'rb');
  14   if (f < 0)
  15     v = 0;
  16   else
  17     t = fread (f, [2, count], 'float');
  18     fclose (f);
  19     v = t(1,:) + t(2,:)*i;
  20     [r, c] = size (v);
  21     v = reshape (v, c, r);
  22   end

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view | diff] (2010-02-22 19:36:54, 1.3 KB) [[attachment:octave_read_complex_binary.m]]
  • [get | view | diff] (2010-02-22 19:36:54, 0.5 KB) [[attachment:read_complex_binary.m]]
  • [get | view | diff] (2010-02-22 19:36:55, 16.0 KB) [[attachment:toolkit.png]]
  • [get | view | diff] (2010-02-22 19:36:55, 0.4 KB) [[attachment:write_complex_binary.m]]
 All files | Selected Files: delete move to page
Normal Sort Sort + uniq Sort + uniq + count

You are not allowed to attach a file to this page.