Hello everyone,
I have few csv files like SS 2012-07-13 to SS 2012-07-30 with a header as the first line.
And the content inside the file is as follows:
Date,Denuder,Htd Line,Impactor,1130 Case,Pump,RPF,Pyro,1135 Case 2012-07-19 23:58:48,95.9,49.2,49.0,31.2,6.80,559.7,450.2,25.1 2012-07-19 23:58:58,94.2,49.2,58.3,31.3,6.80,551.1,441.5,25.1 2012-07-19 23:59:08,92.6,49.1,64.3,31.3,6.80,542.0,432.9,25.1
I want to read these files consecutively using the following code:
close all;clear all;clc;
strDir = 'G:\Shippo 2012\TEKRAN condition\SS\';
fnames = dir(strcat(strDir, '*.csv'));
numfids = length(fnames);
for i = 1:numfids
X = csvread(strcat(strDir, fnames(i).name));
end
But within the loop matlab can not read the data because of the header and is showing the following error:
Mismatch between file and format string.
Trouble reading number from file (row 1, field 1) ==> Date,
Error in ==> csvread at 52
m=dlmread(filename, ',', r, c);
Error in ==> SS_file_daily_plots_m at 9
X = csvread(strcat(strDir, fnames(i).name));
Does anybody have any idea how can I read those csv files simultaneously with the header.
Thank you very much in advance for the assistance.
Best Answer