How to load multiple files sequentially with no standard extension into MATLAB at once
1 view (last 30 days)
Show older comments
I have NASA prognostics bearing dataset with filenames being timestamps with dots resulting in file types like 46, 57, 55 etc. (https://ti.arc.nasa.gov/tech/dash/groups/pcoe/prognostic-data-repository/). The folder 'txt' ( in the path: NASAPrognosticsBearingDatasets -> 3rd_test.rar -> 4th_test -> txt) contains 6324 files with each file having 20480 rows and 4 columns. I want to load the files sequenctially into a matlab as 4 different tables of ( 6324 x 20480 dimension) for each column. Is there any way to do so?
0 Comments
Answers (1)
dpb
on 26 Jul 2020
If you place them all in a clean directory, then
d=dir(fullfile('TheBearingDataSetDirectory','*.*'));
will return all in a directory struct over which you can iterate.
From there, simply process the files in a loop and do whatever with each in turn.
It would appear if they are timestamped and you want to build a large file over the time available loading them into a timetable or timeseris object could be the way to proceed; that would be influenced by just what intend to do with the result as to the more suitable...or whether some other storage entirely.
But, it would seem you'll want/need to convert the filenames retrieved into datetime and sort to put them in time sequence as part of the process...it's probably may want/need to make it a two-step process--first read the filenames and build the ordered sequence; then use that order vector to read the files to build the dataset.
0 Comments
See Also
Categories
Find more on Workspace Variables and MAT-Files 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!