Loading a file with unknown string name but known structure of the string name
3 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I'm trying to load files that contains data of experiments (so let's say hundreds or thousands of files). I don't know the name of the files but I know the structure for example:
Name of the file: aa_bbbb_qqq_wwww
where:
"aa" is an integer number
"bbbb" is the name of the device under test
"qqq" is another number (that describes the experimental setup)
"wwww" is the name of the instrument used to performe the measure.
What is the "load" command (if there is any) to read files in such cases?
Thanks in advance for any hint.
0 件のコメント
回答 (1 件)
Image Analyst
2015 年 2 月 1 日
baseFileName = sprintf(%d_%s_%d_%s.dat', int1, str1, int2, str2);
folder = 'c:\mydata'; % Whatever...
fullFileName = fullfile(folder, baseFileName);
mydata = MyReadingFunction(fullFileName);
Write MyReadingFunction() to read whatever kind of data it is, for example it might contain load(), imread(), readtable(), xlsread() or whatever, depending on what kind of format your data is stored in. Then put that snippet into a loop over all files like you'll find in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!