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