Info

此问题已关闭。 请重新打开它进行编辑或回答。

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 次查看(过去 30 天)
% 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);

回答(1 个)

Image Analyst
Image Analyst 2016-3-16
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 个评论
Image Analyst
Image Analyst 2016-3-17
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.
Sophia
Sophia 2016-3-17
I am already using the one that you have given me..But just trying to figure out the other ways of doing the same thing. I appreciate the fact that you are a very good programmer.

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by