Code covered by the BSD License  

Highlights from
Generate help files from m-files

image thumbnail
from Generate help files from m-files by Wolfgang Garn
Help files are generated from m-files.

getAllDir(root)
function dirs = getAllDir(root)
% getAllDir  gets all directories and subdirectories of a given diretory.
%
% Example
% Reads all directories in the current path.
%+ d = getAllDir( pwd )
%
%% Signature
% Author: W.Garn
% E-Mail: wgarn@yahoo.com
% Date: 2005/12/01 20:00:00 
% 
% Copyright 2005 W.Garn
%
if isempty(root)
    dirs = {};
else
    %root = [pwd '\AccessNet'];
    file = dir( root );
    if ~isempty(file)
        dirs = {};
        for k=1:length(file)
            if file(k).isdir && ~strcmp(file(k).name,'.') && ~strcmp(file(k).name,'..')
                %fprintf(1,'%s\n',[root '\' file(k).name]);
                subdirs = getAllDir([root '\' file(k).name]);
                dirs = [dirs; subdirs; [root '\' file(k).name]];
            end
        end
    end
end

Contact us at files@mathworks.com