findDir

findDir finds recursively all directories in root.

Syntax

Description

example

list =findDir(root) findDir with all default options.

example

list =findDir(root, Name, Value) Example of the use of InclDir.

Examples

expand all

  • findDir with all default options.
  • FullPath=which('findDir');
    root=FullPath(1:end-length('findDir.m')-1);
    list = findDir(root)
    list =
    
      3×1 cell array
    
        {'D:\MATLAB\FSDAgit\FSDA\toolbox\utilities'          }
        {'D:\MATLAB\FSDAgit\FSDA\toolbox\utilities\private'  }
        {'D:\MATLAB\FSDAgit\FSDA\toolbox\utilities\privateFS'}
    
    

  • Example of the use of InclDir.
  • find all subfolders inside matlab help documentaion which contain the string optim

    pathdocroot=docroot;
    FoldersWithOptim=findFile(pathdocroot,'InclDir','*optim*');

    Related Examples

    expand all

  • findDir with optional arguments.
  • FullPath=which('findDir');
    root=FullPath(1:end-length('findDir.m')-1);
    list = findDir(root,'InclDir','datasets');

  • findDir with optional arguments 'InclDir' and 'ExclDir'.
  • FileName='addFSDA2path';
    FullPath=which(FileName);
    root=FullPath(1:end-length(FileName)-3);
    InclDir={'graphics' 'regression' 'multivariate' 'clustering' 'combinatorial' ...
    'examples' 'utilities' 'utilities_stat'};
    ExclDir={'privateFS'  'datasets'};
    list = findDir(root,'InclDir',InclDir,'ExclDir',ExclDir);

    Input Arguments

    expand all

    root — Root directory. String.

    Case sensitive string that can indicate relative or absolute path. Use '.' for current directory.

    Data Types: string

    Name-Value Pair Arguments

    Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

    Example: 'InclDir','dirname' , 'ExclDir','dirname'

    InclDir —Include directory pattern(s).string | cell arrays of strings.

    User can use wildcards. Do not use regular expression, for examples 'abc' and 'ab*de*'. File separator (i.e. '\' in Windows or '/' in Unix) is not allowed. Case-sensitive.

    This filter is skipped if InclDir='', InclDir={}, InclDir='*' or if one of the element of the cell array InclDir is '*'. Default: InclDir={''}.

    Example: 'InclDir','dirname'

    Data Types: (cell array of) string

    ExclDir —Exclude directory pattern(s).string | cell arrays of strings.

    User can use wildcards. Do not use regular expression. Examples: 'abc' and 'ab*de*'. Use '' or {} to skip this stage. File separator (i.e. '\' in Windows or '/' in Unix) is not allowed. Case-sensitive. Default: ExclDir={''}.

    Example: 'ExclDir','dirname'

    Data Types: (cell array of) string

    Output Arguments

    expand all

    list —All subdirectories. Cell array of strings

    List of all subdirectories under root directory, sorted in alphabetical and ascending order. Always return absolute path.

    References

    See Also

    This page has been automatically generated by our routine publishFS