Adds end of line codes for various environments

time-shift
Ferhat Mihoubi 2013-03-22 16:46:52 +01:00
parent 19032f4b07
commit 33bac21c33
1 changed files with 8 additions and 0 deletions

View File

@ -107,12 +107,20 @@ fclose(fid);
% Set newline code (ok for *nix, check for mac and windows)
if isunix
newline_code = 10;
elseif ispc
newline_code = 13;
elseif ismac
newline_code = 10;
else
error('readcsv:: Not implemented for your OS!')
end
% Get the positions of the end-of-line code;
end_of_line_locations = find(bfile==newline_code);
if ispc && isempty(end_of_line_locations)
newline_code=10;
end_of_line_locations = find(bfile==newline_code);
end;
tmp = find(bfile==newline_code);
% Get the number of lines in the file.