Use date strings to specify date range of matfiles to process
2 views (last 30 days)
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
Answers (0)
See Also
Categories
Find more on Spreadsheets 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!