function pc2unix(FileIn, FileOut)
% PC2UNIX   - Convert PC format ascii files to UNIX format
%
% Use as: pc2unix(FileIn)
%         pc2unix(FileIn, FileOut)
%
% Inputs: FileIn  = Name of the file to convert
%         FileOut = Name of converted file. If not specified FileIn is 
%                   overwritten
%
% See also: UNIX2PC

% Brian Schlining
% 10 June 1999

if nargin < 2
   FileOut = FileIn;
end

%======================
% Read the source file
%======================
fidIn = fopen(FileIn,'rt');
x     = fread(fidIn);
fclose(fidIn);

%=========================
% Remove carriage returns
%=========================
i     = find(x ~= 13);
x     = x(i);

%===================
% Write it back out
%===================
fidOut = fopen(FileOut,'w');
fwrite(fidOut, x, 'int8');
fclose(fidOut);

