%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% WrOutInput.m  : write out the input data in C fscanf style, the output 
%                 data is FFT length N and 1-D 'cfftdata_t' array, real 
%                 data first imag data followed
% author        : duweitao
% date          : 2008.June.24
% version       : 0.2
% modify        : 2008.June.30 modify output format to fscanf format 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function WrOutInput(cfg, simData)
% load from the struct obj
  random_T = cfg.random_T   ;  
  sine_T   = cfg.sine_T     ;  
  stimType = cfg.stimType   ;  
  freqNorm = cfg.freqNorm   ;  
  Amp      = cfg.Amp        ;  
  N        = cfg.N          ;  
  fName    = cfg.fName      ;
  fDir     = cfg.fDir       ;
  fDirName = strcat(fDir, fName);
  fprintf(1, '# WrOutInput() Run\n');

  inputData = simData.inputData;
  fid = fopen(fDirName, 'w');
  fprintf(fid, '%d\n', N);
  for(idx = 1:N)
    fprintf(fid, '%-20f %-20f\n', real(inputData(idx)),imag(inputData(idx)));
  end
  fclose(fid);
  fprintf(1, '# File %s wrote out\n', fDirName);


   
end
