From 848bc93ed715ffe2191875a46ec2d5a230e8aee7 Mon Sep 17 00:00:00 2001 From: MarcoRianiUNIPR Date: Tue, 27 Aug 2024 09:24:11 +0200 Subject: [PATCH] Improved comments in m2ipynb and web page regenerated --- toolbox/helpfiles/FSDA/m2ipynb.html | 78 +++++++++++++++++------------ toolbox/utilities/m2ipynb.m | 69 +++++++++++++++---------- 2 files changed, 89 insertions(+), 58 deletions(-) diff --git a/toolbox/helpfiles/FSDA/m2ipynb.html b/toolbox/helpfiles/FSDA/m2ipynb.html index 5d4f29569..c385a034b 100644 --- a/toolbox/helpfiles/FSDA/m2ipynb.html +++ b/toolbox/helpfiles/FSDA/m2ipynb.html @@ -1,14 +1,22 @@ - m2ipynb

m2ipynb

m2ipynb convert selected m files into Jupyter notebook files

Syntax

Description

m2ipynb transforms m files which have a predefined label first + m2ipynb

m2ipynb

m2ipynb converts m files into Jupyter notebook files and automatically creates README.md file with links to Open in MATALB On line

Syntax

Description

m2ipynb transforms m files which have a predefined label first into mlx files and then into Jupiter notebook files. This file also - automatically appends inside README.md files a table written in markup - language. To understand how this table looks like see + automatically creates (or appends to) README.md file a table written in + markup language which contains the list of converted files. For the m + files which are converted the button "Open in MATALB On line" with the associated link is created.

+ To understand how this table looks like see https://github.com/UniprJRC/FigMonitoringBook/tree/main/cap1 or https://github.com/UniprJRC/FigMonitoringBook/tree/main/cap2 or - https://github.com/UniprJRC/FigMonitoringBook/tree/main/cap33 or every - other chapter in the book

example

Incl =m2ipynb() m2ipynb with all default options.

example

Incl =m2ipynb(Name, Value) As before but do not run the mlx files.

example

[Incl, Excluded] =m2ipynb(___) Example 1 of the use of option dirpath.

Examples

expand all

  • m2ipynb with all default options.
  • - Convert first to .mlx and then to .ipynn all .m files in the current - folder which contain 'InsideREADME' and append the table to - README.md

    out=m2ipynb();

  • As before but do not run the mlx files.
  • out=m2ipynb('run',false);

  • Example 1 of the use of option dirpath.
  • + https://github.com/UniprJRC/FigMonitoringBook/tree/main/cap3 or every + other chapter in the book. Note that R files can also be included in + the list. See for example + https://github.com/UniprJRC/FigMonitoringBook/tree/main/cap8.

    > + Remark: note that if the README.md file already exists, the part of the + README.md file before the markdown table with the list of files is not + touched.

    example

    Incl =m2ipynb() m2ipynb with all default options.

    example

    Incl =m2ipynb(Name, Value) Example of m2ipynb with an optional argument.

    example

    [Incl, Excluded] =m2ipynb(___) Example 1 of the use of option dirpath.

    Examples

    expand all

  • m2ipynb with all default options.
  • + Convert first to .mlx and then to .ipynb all .m files in the current + folder which contain the string 'InsideREADME' and append the table to + README.md

    out=m2ipynb();

  • Example of m2ipynb with an optional argument.
  • + As before but do not run the mlx files.

    out=m2ipynb('run',false);

  • Example 1 of the use of option dirpath.
  • In this case dipath is a character associated with a single .m file Just convert file whose name is 'rescaleFS.m'

    InclDir='rescaleFS.m';
     try
    @@ -46,7 +54,7 @@
     % please clone the GitHub folder of FigMonitoringBook using
     % !git clone https://github.com/UniprJRC/FigMonitoringBook.git

    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: 'append2README',false , 'CatchError',false -, 'category','##myPersonalLabel##' +, 'category','##myPersonalLabel##' , 'deleteMLXfiles',true , 'dirpath',pwd , 'FilterOutFileName','veryold' @@ -55,10 +63,11 @@ , repoName 'github/awesome-matlab' , 'run',false , 'runExcluded','UserInteraction' -

    append2README —append or not the list of filtered files to README.md file.

    Boolean. By default the list of filtered files in +

    append2README —append or not the list of filtered files to README.md file.

    Boolean.

    + By default the list of filtered files in the specififed folder will be appended to the README.md file. If this table already exists inside the - README.md, it will be replaced with the current one.

    + README.md, it will be replaced with the current one.

    Example: 'append2README',false

    Data Types: logical

    CatchError —Whether to catch errors.boolean.

    Whether to catch errors when running the live script or function during conversion, specified as a numeric or @@ -68,32 +77,37 @@ occurs, export displays the error in the Command Window and does not create a converted file.

    Example: 'CatchError',false -

    Data Types: logical

    category —label inside the files which have to be translated into - ipynb format.charater | string.

    As default all .m - files which contain the label '%InsideREADME' will be - converted into mlx format and later into ipynb format.

    - They will also be included in the table inside the - README.md file -

    Example: 'category','##myPersonalLabel##' -

    Data Types: character or string

    deleteMLXfiles —delete or not the .mlx files after their conversion to jupiter notebook format.

    Boolean. The default is false, that is .mlx are note - deleted after their conversion to ipynb format.

    +

    Data Types: logical

    category —label inside the files which specifies whether the file + to be converted to ipynb format and included into + README.md file.

    Charater or string.

    + As default all .m files which contain the label + '%InsideREADME' will be converted into mlx format and + later into ipynb format. These will also be included + in the table inside the README.md file. Also all .R + files which contain the label '#InsideREADME' will be + included in the README.md file. In the case of .R files + instead of the button Open in MATLAB On line there is + simply the link to open the file inside GitHub.

    +

    Example: 'category','##myPersonalLabel##' +

    Data Types: character or string

    deleteMLXfiles —delete or not the .mlx files after their conversion to jupiter notebook format.

    Boolean.

    + The default is false, that is .mlx are note + deleted after their conversion to ipynb format.

    Example: 'deleteMLXfiles',true -

    Data Types: logical

    dirpath —path to use or file to convert.cell array of characters | character.

    Absolute path of - the folder(s) for which m2ipynb files must be created.

    - If dirpath is not specified or it is empty all .m files - in the current folder with the category label will be - converted. If dirpath is a cell array of characters - then .m file are converted for all specified subfolders.

    - If dirpath is a charater containing a single file - in the current folder, just this file will be - converted. In this case last case file README.md will - not be modified (because it is assumed one just wants - to regeenerate a single file) +

    Data Types: logical

    dirpath —path to use or file to convert.cell array of characters | character.

    Absolute path of the folder(s) for which m2ipynb files + must be created. If dirpath is not specified or it is + empty all .m files in the current folder with the + category label will be converted. If dirpath is a cell + array of characters then .m file are converted for all + specified subfolders. If dirpath is a charater + containing a single file in the current folder, just + this file will be converted. In this case last case + file README.md will not be modified (because it is + assumed one just wants to regenerate a single file) Remark: dirpath can be conveniently created with function findDir -

    Example: 'dirpath',pwd +

    Example: 'dirpath',pwd

    Data Types: cell array of characters or char

    FilterOutFileName —filter files depending on their name.character | String.

    Character or 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.

    diff --git a/toolbox/utilities/m2ipynb.m b/toolbox/utilities/m2ipynb.m index 8d000f84c..8535ab7d5 100644 --- a/toolbox/utilities/m2ipynb.m +++ b/toolbox/utilities/m2ipynb.m @@ -1,16 +1,23 @@ function [Incl, Excluded]=m2ipynb(varargin) -%m2ipynb convert selected m files into Jupyter notebook files +%m2ipynb converts m files into Jupyter notebook files and automatically creates README.md file with links to Open in MATALB On line % %Link to the help function % % m2ipynb transforms m files which have a predefined label first % into mlx files and then into Jupiter notebook files. This file also -% automatically appends inside README.md files a table written in markup -% language. To understand how this table looks like see +% automatically creates (or appends to) README.md file a table written in +% markup language which contains the list of converted files. For the m +% files which are converted the button "Open in MATALB On line" with the associated link is created. +% To understand how this table looks like see % https://github.com/UniprJRC/FigMonitoringBook/tree/main/cap1 or % https://github.com/UniprJRC/FigMonitoringBook/tree/main/cap2 or % https://github.com/UniprJRC/FigMonitoringBook/tree/main/cap3 or every -% other chapter in the book +% other chapter in the book. Note that R files can also be included in +% the list. See for example +% https://github.com/UniprJRC/FigMonitoringBook/tree/main/cap8. +% Remark: note that if the README.md file already exists, the part of the +% README.md file before the markdown table with the list of files is not +% touched. % % Required input arguments: % @@ -18,7 +25,9 @@ % % % append2README: append or not the list of filtered files to README.md -% file. Boolean. By default the list of filtered files in +% file. +% Boolean. +% By default the list of filtered files in % the specififed folder will be appended to the README.md % file. If this table already exists inside the % README.md, it will be replaced with the current one. @@ -36,36 +45,43 @@ % Example - 'CatchError',false % Data Types - logical % -% category : label inside the files which have to be translated into -% ipynb format. Charater or string. As default all .m -% files which contain the label '%InsideREADME' will be -% converted into mlx format and later into ipynb format. -% They will also be included in the table inside the -% README.md file -% Example - 'category','##myPersonalLabel##' +% category : label inside the files which specifies whether the file +% to be converted to ipynb format and included into +% README.md file. +% Charater or string. +% As default all .m files which contain the label +% '%InsideREADME' will be converted into mlx format and +% later into ipynb format. These will also be included +% in the table inside the README.md file. Also all .R +% files which contain the label '#InsideREADME' will be +% included in the README.md file. In the case of .R files +% instead of the button Open in MATLAB On line there is +% simply the link to open the file inside GitHub. +% Example - 'category','##myPersonalLabel##' % Data Types - character or string % % % % deleteMLXfiles : delete or not the .mlx files after their conversion to % jupiter notebook format. -% Boolean. The default is false, that is .mlx are note +% Boolean. +% The default is false, that is .mlx are note % deleted after their conversion to ipynb format. % Example - 'deleteMLXfiles',true % Data Types - logical % % dirpath: path to use or file to convert. -% Cell array of characters or character. Absolute path of -% the folder(s) for which m2ipynb files must be created. -% If dirpath is not specified or it is empty all .m files -% in the current folder with the category label will be -% converted. If dirpath is a cell array of characters -% then .m file are converted for all specified subfolders. -% If dirpath is a charater containing a single file -% in the current folder, just this file will be -% converted. In this case last case file README.md will -% not be modified (because it is assumed one just wants -% to regenerate a single file) +% Cell array of characters or character. +% Absolute path of the folder(s) for which m2ipynb files +% must be created. If dirpath is not specified or it is +% empty all .m files in the current folder with the +% category label will be converted. If dirpath is a cell +% array of characters then .m file are converted for all +% specified subfolders. If dirpath is a charater +% containing a single file in the current folder, just +% this file will be converted. In this case last case +% file README.md will not be modified (because it is +% assumed one just wants to regenerate a single file) % Example - 'dirpath',pwd % Data Types - cell array of characters or char % Remark: dirpath can be conveniently created @@ -165,13 +181,14 @@ %{ % m2ipynb with all default options. - % Convert first to .mlx and then to .ipynn all .m files in the current - % folder which contain '%InsideREADME' and append the table to + % Convert first to .mlx and then to .ipynb all .m files in the current + % folder which contain the string '%InsideREADME' and append the table to % README.md out=m2ipynb(); %} %{ + % Example of m2ipynb with an optional argument. % As before but do not run the mlx files. out=m2ipynb('run',false); %}