Info
This question is closed. Reopen it to edit or answer.
I have a folder named 'means' which has further sobfolders numbered from '1979-2015', each subfolder has 12 files, i want to process each of that file. But how to call this folder , subfolder and further all the files.
1 view (last 30 days)
Show older comments
% this is how i am going to process each of these files
fid1 = fopen(filename, 'r', 'ieee-le');
data = fread(fid1, 390963, 'int16');
tdata = reshape(data,3,361,361);
fclose(fid1);
u = squeeze(tdata(1,:,:)./10);
v = squeeze(tdata(2,:,:)./10);
error = tdata(3,:,:);
nu = u.*cos(rlong) + v.*sin(rlong);
nv = -u.*sin(rlong) + v.*cos(rlong);
0 Comments
Answers (1)
Image Analyst
on 16 Mar 2016
You can use a function built for this. It's called genpath() and generates a list of all subfolders below the specified folder. Attached is an example where I go into all subfolders and then use dir() to get a list of files living in that folder.
3 Comments
Image Analyst
on 17 Mar 2016
I don't understand this. If I wanted to do something and someone showed me a way that I hadn't thought of, I would use it. If it was somewhat more clever or tricky than I would have thought up on my own, I might still use it as long as it make sense and I was able to understand/follow it. But whatever - do what you want. There are more complicated ways to get the sub-directories using just dir() instead of genpath() if you want to discover it or develop it on your own. Anyway, good luck.
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!