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')

 Accepted Answer

Walter Roberson
Walter Roberson on 15 Oct 2012

1 vote

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

4 Comments

Lisa Justin
Lisa Justin on 15 Oct 2012
Edited: Lisa Justin on 15 Oct 2012
i need to read a csv file line by line any ideas?
fopen() it, fgetl() to read a line. fclose() after you are done.
thanks
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

Sign in to comment.

More Answers (1)

Sachin Ganjare
Sachin Ganjare on 16 Oct 2012

0 votes

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

Categories

Tags

Community Treasure Hunt

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

Start Hunting!