Loading a file with unknown string name but known structure of the string name
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Image Analyst
le 1 Fév 2015
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 commentaires
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!