From f16a8b1658d5fa6481b0804c29b3e03e61a8c08f Mon Sep 17 00:00:00 2001
From: Ferhat Mihoubi <ferhat.mihoubi@univ-evry.fr>
Date: Fri, 22 Mar 2013 15:27:42 +0100
Subject: [PATCH] indicates the endline code for various environments

---
 matlab/load_csv_file_data.m | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/matlab/load_csv_file_data.m b/matlab/load_csv_file_data.m
index 4e1576c75..1444ed34d 100644
--- a/matlab/load_csv_file_data.m
+++ b/matlab/load_csv_file_data.m
@@ -107,12 +107,21 @@ 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.
@@ -138,7 +147,7 @@ if withnames
     varlist = cell(length(B),1);
     number_of_variables = length(varlist);
     for i=1:number_of_variables
-        varlist(i) = {linee(B(i):C(i))};
+        varlist(i) = {strtrim(linee(B(i):C(i)))};
     end
     linea = linea+1;
 end
-- 
GitLab