How can i read a csv file

How can i read a csv file. i used fopen but it gives a value of -1
A=fopen('slip.csv')

 채택된 답변

Walter Roberson
Walter Roberson 2012년 10월 15일

1 개 추천

csv files are text files, usually written in ASCII or ISO-8896-1 (which is compatible with ASCII).

댓글 수: 4

Lisa Justin
Lisa Justin 2012년 10월 15일
편집: Lisa Justin 2012년 10월 15일
i need to read a csv file line by line any ideas?
Walter Roberson
Walter Roberson 2012년 10월 15일
fopen() it, fgetl() to read a line. fclose() after you are done.
Lisa Justin
Lisa Justin 2012년 10월 18일
thanks
Lisa Justin
Lisa Justin 2012년 10월 18일
Hi Walter, i also want to creat a file list of the large csv data i have. when i write dir *.csv i get all data displayed but when i try to write a script say
dir=('C:\Lisajustin\Vib')
Listdir=sprintf('%d%d',dir, '\*.csv');
i get error message ??? Error using ==> sprintf Function is not defined for 'struct' inputs.
what could be the problem

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

추가 답변 (1개)

Sachin Ganjare
Sachin Ganjare 2012년 10월 16일

0 개 추천

You can use 'csvread' function. Refer link below for further details:
Hope it helps!!!

카테고리

도움말 센터File Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by