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

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 7월 29일

0 개 추천

댓글 수: 8

Cordelle
Cordelle 2013년 7월 29일
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 2013년 7월 29일
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 2013년 7월 29일
Try xlsread
Cordelle
Cordelle 2013년 7월 29일
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 2013년 7월 29일
what does a,b,c correspond too?
a : numeri variable
b: text variable
c: both numeric and text variable
Cordelle
Cordelle 2013년 7월 29일
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)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

태그

Community Treasure Hunt

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

Start Hunting!

Translated by