Reading text and Numbers (mixed data type) from a .csv file MATLAB -


my data in csv file of form:

days of week      date        time(hrs)        visitors mon            jan 2 2010     900               501  mon            jan 2 2010    1000               449 mon            jan 2 2010    1100               612 

the problem csv file progressively gets updated new column everytime run script , becomes:

days of week      date        time(hrs)        visitors     visitors1 mon            jan 2 2010     900               501           200 mon            jan 2 2010    1000               449           100 mon            jan 2 2010    1100               612           300 

this progressively gets updated column (visitors(n)) n dynamically changing based on matlab script.now need smart way formatspecifier add "%d" textscan formatspec parameter everytime try read csv file till n-th time of visitor column

fid = fopen('data.csv'); c = textscan(fid, '%s %s %d %d', 'delimiter','\t'); fclose(fid); 

also, open smarter or bette way of doing if possible without using above method. whole idea have mixed data type involved in csv file read.


Comments