How can I load a set of files ordered by date and time?

5 ビュー (過去 30 日間)
Patrick
Patrick 2013 年 10 月 31 日
編集済み: sixwwwwww 2013 年 10 月 31 日
I know there is a loop that can be written to do this. I have many files ordered by time and date that I would like to load. They are in the following format:
TS2004.07.01.0000.txt
TS2004.07.01.0300.txt
TS2004.07.01.0600.txt ...
TS2004.07.01.2100.txt
TS2004.07.02.0000.txt ...
How can I write the loop so that these files load without me having to manually write out the whole list?

採用された回答

sixwwwwww
sixwwwwww 2013 年 10 月 31 日
編集済み: sixwwwwww 2013 年 10 月 31 日
Dear Patrick, you can use 'dir' command to get information of all the files in a specific folder as:
files = dir('C:\Users\UserName\Desktop\*.txt'); % Get infotmation of all .txt files on Desktop
names = {files.name}; % Get the name of files and save them in a cell array
Then you can use 'names' to load files easily. I hope it helps. Good luck!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by