Applies lowpass filter and correctly formats date-stamp.
First load in CVS file into MATALB this creates a 'data' and 'textdata' array
//split up data array into individual sensor readings
T1=data(:,1); T2=data(:,2); T3=data(:,3); T4=data(:,4); H1=data(:,5); H2=data(:,6); H3=data(:,7); //filter data windowsSize=100; T1_filtered=filter(ones(1,windowsSize)/windowsSize,1,T1); T2_filtered=filter(ones(1,windowsSize)/windowsSize,1,T2); T3_filtered=filter(ones(1,windowsSize)/windowsSize,1,T3); T4_filtered=filter(ones(1,windowsSize)/windowsSize,1,T4); H1_filtered=filter(ones(1,windowsSize)/windowsSize,1,H1); H2_filtered=filter(ones(1,windowsSize)/windowsSize,1,H2); H3_filtered=filter(ones(1,windowsSize)/windowsSize,1,H3); //save filtered data back into 'data' array filtered_data(:,1)=T1_filtered; filtered_data(:,2)=T2_filtered;
filtered_data(:,3)=T3_filtered;
filtered_data(:,4)=T4_filtered;
filtered_data(:,5)=H1_filtered;
filtered_data(:,6)=H2_filtered;
filtered_data(:,7)=H3_filtered;
//convert '.' date seperator to '/' TimeStamp=textdata(:,1) //extract dateand time
TimeStamp(1,:)=[]; //delete first header row of timestamp DateNumberArray = datenum(TimeStamp, 'dd.mm.yyyy HH:MM:SS'); //create matlab date array DateString = datestr(DateNumberArray, 'dd/mm/yyyy HH:MM'); //output date in correct format (with '/' instread of '.')
DateString_cell=cellstr(DateString);
cell2csv('DateString.csv',DateString_cell); // http://www.mathworks.com/matlabcentral/fileexchange/4400-cell-array-to-csv-file-cell2csv-m
newdata(:,1)=T1_filtered;
newdata(:,2)=T2_filtered;
newdata(:,3)=T3_filtered;
newdata(:,4)=T4_filtered;
newdata(:,5)=H1_filtered;
newdata(:,6)=H2_filtered;
newdata(:,7)=H3_filtered;
newdata_cell=num2cell(newdata);
cell2csv('newdata.csv',newdata_cell);