makecontentsfileFS

makecontentsfileFS extends Matlab function makecontentsfile

Syntax

  • out=makecontentsfileFS()example
  • out=makecontentsfileFS(Name,Value)example
  • [out, Excluded]=makecontentsfileFS(___)example

Description

makecontentsfileFS creates a file named contents which contains information about selected files present in folder and/or subfolders

example

out =makecontentsfileFS() makecontentsfileFS with all default options.

example

out =makecontentsfileFS(Name, Value) Create personalized content file of selected subfolders.

example

[out, Excluded] =makecontentsfileFS(___) Example of the use of options dirpath and FilterFileContent.

Examples

expand all

  • makecontentsfileFS with all default options.
  • Just create output cell out but not the output file if it already exists.

    % Create personalized content file of current folder.
    out=makecontentsfileFS('force',false);

  • Create personalized content file of selected subfolders.
  • Create contents file for subfolder '(main root of FSDA)\utilities' and list just the files which contain string 'FScategory:'

    FileName='addFSDA2path';
    FullPath=which(FileName);
    FSDAroot=FullPath(1:end-length(FileName)-3);
    dirpathsel=[FSDAroot filesep 'utilities'];
    %  Note that force is false and therefore just output cell is created.
    out=makecontentsfileFS('dirpath',dirpathsel,'FilterFileContent','%FScategory:','force',false);

  • Example of the use of options dirpath and FilterFileContent.
  • Preliminary step: create a list of the subfolders which have to be included, using routine findDir with options 'InclDir' and 'ExclDir'.

    % Find full path of the main root where FSDA is installed
    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'};
    % Create list of folders which must have a personalized contents file
    list = findDir(root,'InclDir',InclDir,'ExclDir',ExclDir)
    % Crete personalized contents file for main folder of FSDA
    % and required subfolders.
    [out,Excluded]=makecontentsfileFS('dirpath',list,'FilterFileContent','%FScategory:','force',false);

    Input Arguments

    expand all

    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: 'dirpath',pwd , 'NameOutputFile','Mycontents.m' , 'force',false , 'FilterOutFileName','veryold' , 'FilterFileContent','

    dirpath —path to use.string | cell array of strings.

    Absolute path of the folder(s) for which summary file must be created.

    If dirpath is not specified dirpath is the one of the current folder and it is found using MATLAB instruction pwd. If dirpath is a cell array of string then NameOutputFile is created for all entry of dirpath.

    Remark: dirpath can be conveniently created with function findDir

    Example: 'dirpath',pwd

    Data Types: string

    NameOutputFile —Name of output file.string.

    String containing the name of the file which has to be created. If this option is not specified Contents is used.

    Example: 'NameOutputFile','Mycontents.m'

    Data Types: string

    force —Overwrite existing file.boolean.

    Boolean which specifies whether existing output file must be overwritten. If force is true (default) FileName is overwritten else just out cell is produced

    Example: 'force',false

    Data Types: string

    FilterOutFileName —filter files depending on their name.string.

    String which specifies which .m files do not have to be included inside NameOutputFile. All files whose name contains FilterOutFileName will not be included inside NameOutputFile.

    If this optional argument is not specified all files containing string [OlD] (lower case or uppercase) will not be listed inside NameOutputFile

    Example: 'FilterOutFileName','veryold'

    Data Types: string

    FilterFileContent —filter .m files depending on their content.

    String.

    String which specifies the string files must contain to be included inside NameOutputFile.

    If this optional argument is not specified or it is empty all files .m file (whose name does not contain FilterOutFileName) will be listed inside NameOutputFile. In the final column of output cell dout, the letters after FilterFileContent will be shown. For example suppose that FilterFileContent is '%TAGFDSA' and that two files respectively contain the words '%TAGFDSAregression' and '%TAGFDSAmultivariate' then the words 'regression' and 'multivariate' will be given inside last column of dout and inside NameOutputFile under column 'category'

    Example: 'FilterFileContent','

    printOutputCell —print out cell is a file.string.

    String contaning the name of the file of the current folder which contains the summary of all files present in findDir folders. The default value of printOutputCell is '' that is the overall content file is not created

    Example: 'printOutputCell','ContentsAll.m'

    Data Types: string

    msg —It controls whether to display or not messages on the screen.scalar.

    If msg==false (default) messages are not displayed on the screen about all files which will form the overall content and warnings are shown on the screen.

    Example: 'msg',false

    Data Types: boolean

    Output Arguments

    expand all

    out —Selected Tags. structured information of filtered files

    Cell.

    Cell of size r-times-9 containing detailed information about the files present in required folder or folders if dirpath is a cell array of strings.

    The columns of dout contain the following information:

    out(:,1)= name of the file (with extension);

    out(:,2)= date (in local format);

    out(:,3)= size of the files in bytes;

    out(:,4)= boolean 1 if name is a folder and 0 if name is a file;

    out(:,5)= Modification date as serial date number;

    out(:,6)= matlab file name (without .m extension);

    out(:,7)= file description (the so called H1 line of the file);

    out(:,8)= string which identifies file category. File category is the string after 'FilterFileContent' in each file.

    out(:,9)= string which contains file path.

    Remark: if the file contains:

    FilterFileContentword1 in row 34;

    FilterFileContentAnotherName in row 456;

    FilterFileContentObama, in row 1243;

    than category is associated to the last instance which is found (in this example 'Obama').

    Excluded —structured information of m files not included. Cell

    Cell of size r-times-9 containing detailed information about the files present in required folder or folders if dirpath is a cell array of strings but which have been excluded by the filters.

    The columns of Excluded contain the following information:

    Excluded(:,1)= name of the file (with extension);

    Excluded(:,2)= date (in local format);

    Excluded(:,3)= size of the files in bytes;

    Excluded(:,4)= boolean 1 if name is a folder and 0 if name is a file;

    Excluded(:,5)= Modification date as serial date number;

    Excluded(:,6)= matlab file name (without .m extension);

    Excluded(:,7)= file description (the so called H1 line of the file);

    Excluded(:,8)= string which identifies file category. File category is the string after 'FilterFileContent' in each file.

    Excluded(:,9)= string which contains file path.

    References

    This page has been automatically generated by our routine publishFS