How to read a .csv file in matlab?

my .csv file opens in excel and every row is in the form:
2013 | 094 | 22:57:13 | 2456387.456 | 5.002 | 0.006 | 4.992 | 0.001 | -0.01 | -0.005 | 7.99 | 5 | 2 | 0
| : represents a space (it is not in the .csv file)
I would like to read every numeric value in the file (not including the semi-colon [:] )
thanks in advance,
Cordelle

 Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 29 de Jul. de 2013

0 votos

8 comentarios

Cordelle
Cordelle el 29 de Jul. de 2013
I did and once the csvread function encountered the colon(:) an error message occured, heres the code
[FileName,FilePath ]= uigetfile(); ExPath1 = fullfile(FilePath, FileName);
c = csvread(ExPath1,5,0);
Cordelle
Cordelle el 29 de Jul. de 2013
The error message that occured:
Error using dlmread (line 139)
Mismatch between file and format string.
Trouble reading number from file (row 1u, field 4u) ==> :57:13, 2456387.456405440, 5.002, 0.006, 4.992, 0.001, -0.010, -0.005, 7.99, 5, 2, 0.000\n
Azzi Abdelmalek
Azzi Abdelmalek el 29 de Jul. de 2013
Try xlsread
Cordelle
Cordelle el 29 de Jul. de 2013
I tried xlsread and it runs just fine except when reading in the input matlab is reading NaN 0.0000 Nan and etc
Use
[a,b,c]=xlsread('fic.csv')
Then use the cell array c
Cordelle
Cordelle el 29 de Jul. de 2013
what does a,b,c correspond too?
a : numeri variable
b: text variable
c: both numeric and text variable
Cordelle
Cordelle el 29 de Jul. de 2013
being that I have three different arguments available, How can I re-write the info back into an excel file with a different name using
xlswrite(someName, argument)

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by