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 日間)
Sophia
Sophia 2016 年 3 月 16 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
% 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