I have a directory called MATLAB in which i have all my .m codes and couple of separate folders, each folder further has subfolders, How can i call the subfolders?

2 vues (au cours des 30 derniers jours)
for y=1979:2012;
% open binary file for % Polar Pathfinder Daily 25 km EASE-Grid Sea Ice Motion Vectors, Version 2
folderpath = ('/Users/Documents/MATLAB/weeks/');
stryear = num2str(y);
filepath = fullfile(folderpath,stryear);
files = dir(fullfile(filepath,'/icemotion.mean.week.*.n.v02.bin') );
files = {files.name};

Réponse acceptée

Image Analyst
Image Analyst le 25 Jan 2016
You can use genpath() to generate a list of all subfolders. Then you can do stuff with files in those folders. See my attached demo.
  5 commentaires
Image Analyst
Image Analyst le 26 Jan 2016
You forgot to paste the error message.
What is the name of the deepest, longest folder that it chokes on?
Sophia
Sophia le 16 Mar 2016
I tried this on a different place..and it totally works, thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Search Path dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by