I am trying to import a csv file with Matlab, containing headerlines and several columns. It starts like :
Essai : Taux 1;"1,00000";mm/min
Déformation : Déformation de traction (Déplacement) longueur initiale;"100,00000";mm
Généralités : Date de début;"09/07/2015 17:12"
Généralités : Date de fin;"09/07/2015 17:15"
Temps;Charge;Déplacement traverse
(s);(N);(mm)
"0,00000";"-0,22448";"0,00000"
"0,10000";"2,56269";"0,00093"
"0,20000";"3,84100";"0,00328"
"0,30000";"3,84073";"0,00524"
"0,40000";"4,06938";"0,00648"
...
I can import it with xlsread removing the headerlines by hand :
A = xlsread('filename.csv');
B = A(n_headerlines+1:end,:);
and it works fine. However, when I reach thousands, there are unrelevant spaces in my data :
...
"147,70000";"984,81097";"2,46197"
"147,80000";"998,60400";"2,46318"
"147,89999";"1 020,65094";"2,46489"
"148,00000";"1 043,27832";"2,46694"
...
which gives NaN's in A or B after importing the data.
How can I remove these spaces while keeping the csv format ? I was thinking of using strrep but I cannot figure out how without destroying the formatting of my csv file.
Thank you for you help !
NaN
s inA
are bothering you, you can just get rid of them withA(isnan(A))=[];
after your call toxlsread
. - Hoki