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

 Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 29 Jul 2013

8 Comments

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);
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
Try xlsread
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
what does a,b,c correspond too?
a : numeri variable
b: text variable
c: both numeric and text variable
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)

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!