how to import data from multiple folders in matlab?
5 views (last 30 days)
Show older comments
I have my data in multiple folders. let say i have a folder containing 3 subfolders at the moment that look like this
/folder/Re0001/vitesse
/folder/Re0002/vitesse
/folder/Re0003/vitesse
i want to import the vitesse file in to cell array. this is the code that i am using at the moment
*numfiles=3;
mydata=cell(1,numfiles);
for i=1:numfiles
mydata{i}=uiimport;
end*
##really appreciate if u can help me. I am stuck with this for almost 3 days. thanks
0 Comments
Answers (1)
Muthu Annamalai
on 1 Jul 2013
I don't understand your question. You seem to already have a working solution.
filenames = {'path/1/fil1', ... }
numfiles= length(filenames);
mydata=cell(1,numfiles);
for i=1:numfiles
mydata{i}=load( filename{numfiles} );
end
If you want to access filenames dynamically you can use the dir() command.
q = dir('./')
filenames = {q.name}
You don't have a choice except for specifying the files to look for with load. Its a simple task to do.
See Also
Categories
Find more on File Operations 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!