|
"mee gestaf" wrote in message <j98tlt$4rm$1@newscl01ah.mathworks.com>...
> Please someone give me a hint with this one.
> I want to make a application that automatically reads data from .mat files saved in a folder.
> In folder I have many files that look like this :
>
> ChPow---18-10---1-26.mat
> ZSpan---18-10---1-9.mat
> ChPow---18-10---1-35.mat
> ZSpan---18-10---10-1.mat
> ChPow---18-10---1-43.mat
> ZSpan---18-10---10-19.mat
> ChPow---18-10---1-53.mat
> ZSpan---18-10---10-29.mat
> ChPow---18-10---10-10.mat
> ZSpan---18-10---10-37.mat
> ChPow---18-10---10-2.mat
> ZSpan---18-10---10-45.mat
>
> Where "18-10" is the date when they were created, and the other one ex. "1-26" is the hour and minute. I want to process only the .mat files that are between two given start and stop time, in the order that they were created. I'm blocked because I don't know how to query those in the name of the files. If I do a "dir" command in matlab it will give me a structural variable that has information about every file when it was created in a string format, and I don't know if matlab can calculate time comparison. I was thinking of making a matrix with all the files that meet the criteria and then invoke them to read the data from them.
> Please help...
use regexp to decipher which filenames u want.
extract all the filenames using "dir" and "name" field
for i = 1:number of files
if (regexp(decipher file name) is what I want)
process the file
end
end
if the filenames have consistent names, u can also use strcmp or strncmp instead of regexp
|