% spawnViewDat
% 
% Script to extract the record 29 data from the T01 file and save it
% into a MAT file. 
% 

function spawnViewDat ( parameters )

if ( parameters.reloadFile || ~parameters.extractT01File )
  disp('Skipping extraction of position data from T01 file using viewdat.');
  return;
end

disp('Extracting position data from T01 file using viewdat.');

if ( parameters.posRecType == 29 )
  shellStr = sprintf( 'viewdat -d29 -h -m %s > rec29.txt\n', ...
    parameters.fileName );
else
  % posRecType = 11. This was verified in loadParameterFile.m
  shellStr = sprintf( 'viewdat -d11 -h -m %s > rec11.txt\n', ...
    parameters.fileName );
end

system ( shellStr );

return; 