Commit f16a8b16 authored by Ferhat Mihoubi's avatar Ferhat Mihoubi
Browse files

indicates the endline code for various environments

parent 8531d994
...@@ -107,12 +107,21 @@ fclose(fid); ...@@ -107,12 +107,21 @@ fclose(fid);
% Set newline code (ok for *nix, check for mac and windows) % Set newline code (ok for *nix, check for mac and windows)
if isunix if isunix
newline_code = 10; newline_code = 10;
elseif ispc
newline_code = 13;
elseif ismac
newline_code = 10;
else else
error('readcsv:: Not implemented for your OS!') error('readcsv:: Not implemented for your OS!')
end end
% Get the positions of the end-of-line code; % Get the positions of the end-of-line code;
end_of_line_locations = find(bfile==newline_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); tmp = find(bfile==newline_code);
% Get the number of lines in the file. % Get the number of lines in the file.
...@@ -138,7 +147,7 @@ if withnames ...@@ -138,7 +147,7 @@ if withnames
varlist = cell(length(B),1); varlist = cell(length(B),1);
number_of_variables = length(varlist); number_of_variables = length(varlist);
for i=1:number_of_variables for i=1:number_of_variables
varlist(i) = {linee(B(i):C(i))}; varlist(i) = {strtrim(linee(B(i):C(i)))};
end end
linea = linea+1; linea = linea+1;
end end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment