Make Matlab listing ONLY subfolders cointained into a folder
From the Matlab Command Window when you type "dir" you get a list of files and folders contained in your working directory.
The question is how can you get ONLY the folders?
Here is the solution from stackoverflow.
NOTE
In the following function the output "nameFolds" is a cell!!!
------------------------------------------------------------------------------------------
function nameFolds=ListSubfolders(pathFolder)
d = dir(pathFolder);
isub = [d(:).isdir];
nameFolds = {d(isub).name}';
nameFolds(ismember(nameFolds,{'.','..'})) = [];
-----------------------------------------------------------------------------------------
alternative link
GO TO THE HOME PAGE
The question is how can you get ONLY the folders?
Here is the solution from stackoverflow.
NOTE
In the following function the output "nameFolds" is a cell!!!
------------------------------------------------------------------------------------------
function nameFolds=ListSubfolders(pathFolder)
d = dir(pathFolder);
isub = [d(:).isdir];
nameFolds = {d(isub).name}';
nameFolds(ismember(nameFolds,{'.','..'})) = [];
-----------------------------------------------------------------------------------------
alternative link
GO TO THE HOME PAGE
Comments