Use date strings to specify date range of matfiles to process
Show older comments
Hi Guys
I have the following file structure
VehicleName\Matfiles\Month\VehicleName_Registration_Type_yymmdd.mat
Currently I can only process data from a vehicles month folder.
I want to compare data for the same vehicle but in a specified date range
e.g
130101-130210
this would take me across two month folders and also only use data until the 10th of Feb.
My Current Code is
VehicleInfo=find(ismember(FTDatabase(:,1),VehicleName));
if isempty(VehicleInfo)
error([VehicleName, ' is not in vehicle database'])
end
Database1 = Database{VehicleInfo, 2};
Database2 = Database{VehicleInfo, 3};
Database3 = Database{VehicleInfo, 4};
Database4 = Database{VehicleInfo, 5};
end
MATfileDIR = ([ DataLocation,'\',Program,'\',Application,'\' VehicleName,'\MatData_Files','\',Month,'_matfiles']);
MatFiles = what(MATfileDIR);
DayFiles=MatFiles.mat;
i=0;
for WhichMat = 1:length(DayFiles);
SelectedMat = DayFiles{WhichMat};
StructureName = DayFiles;
MATfile = ([MATfileDIR, '\', SelectedMat]);
index = strfind(SelectedMat,'_');
S = SelectedMat(index(end):end); % Supplied By Jan Simon
DateVal= {[S(6:7),S(4:5),S(2:3)];};% Supplied by Jan Simon
DateNum = datenum(DateVal,'ddmmyy');
Date = DateNum;
i =i+1;
DATA = load(MATfile);
disp({'Loading' , SelectedMat})
Database holds the vital information for each vehicle. So the end result that I cant get to work is MATfile being a list of the filepath of all the matfiles that have the correct date range
3 Comments
Ahmed A. Selman
on 4 Apr 2013
Please specify more the meaning of (compare data). Perhaps you want to _visually _compare the data from the specified files?
I don't really know about the data type held in such files since they are being fed from a specific database, but I think that, comparing data from files numerically is not such a practical thing to do, not always, anyway.
James hall
on 5 Apr 2013
Answers (0)
Categories
Find more on Time Series Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!