ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
getEntryNML.m File Reference

Go to the source code of this file.

Functions

function getEntryNML (in varname, in varval, in vartype, in varsize)
 Return a Fortran-namelist-compatible conversion of the input varval.
More...
 

Function Documentation

◆ getEntryNML()

function getEntryNML ( in  varname,
in  varval,
in  vartype,
in  varsize 
)

Return a Fortran-namelist-compatible conversion of the input varval.

This functionality is primarily used by the ParaMonte MATLAB internal routines to communicate information with Fortran shared libraries.
As such, it is of limited to most end users of the library.

Parameters
[in]varname: The input scalar MATLAB string containing the label to assign to the namelist-converted value in the output entry.
The specified value of varname will be trimmed (to remove leading and trailing blanks).
[in]varval: The input value to be converted to namelist-compatible value.
[in]vartype: See the documentation of the corresponding argument of pm.introspection.istype().
[in]varsize: See the documentation of the corresponding argument of pm.introspection.istype().
Returns
entry : The output scalar MATLAB string containing the namelist-compatible conversion of the input value varval and the given varname in the following format: varname=namelist-compatible-varval.


Possible calling interfaces

entry = pm.introspection.getEntryNML(varname, varval, vartype, varsize)
Note
If the input value is string, it will be quoted properly.
If the input varval is an array, its elements will be comma-separated.


Example usage

1cd(fileparts(mfilename('fullpath'))); % Change working directory to source code directory.
2addpath('../../../'); % Add the ParaMonte library root directory to the search path.
3
4disp('pm.introspection.getEntryNML("outputChainSize", 10000, "integer", 1)')
5disp( pm.introspection.getEntryNML("outputChainSize", 10000, "integer", 1) )
6
7disp('pm.introspection.getEntryNML("proposalMean", [1, 0], "double", 2)')
8disp( pm.introspection.getEntryNML("proposalMean", [1, 0], "double", 2) )
9
10disp('pm.introspection.getEntryNML("mpiEnabled", false, "logical", 1)')
11disp( pm.introspection.getEntryNML("mpiEnabled", false, "logical", 1) )
12
13disp('pm.introspection.getEntryNML("description", "This is the description", "string", 1)')
14disp( pm.introspection.getEntryNML("description", "This is the description", "string", 1) )
15
16try
17 pm.introspection.getEntryNML("varname", "value", "cell", 1);
18catch me
19 disp(string(me.identifier) + newline + string(me.message));
20end
21
22try
23 pm.introspection.getEntryNML("varname", [1, 2], "array", 1);
24catch me
25 disp(string(me.identifier) + newline + string(me.message));
26end
function getEntryNML(in varname, in varval, in vartype, in varsize)
Return a Fortran-namelist-compatible conversion of the input varval.
function root()
Return a scalar MATLAB string containing the root directory of the ParaMonte library package.

Example output
1pm.introspection.getEntryNML("outputChainSize", 10000, "integer", 1)
2outputChainSize=10000
3pm.introspection.getEntryNML("proposalMean", [1, 0], "double", 2)
4proposalMean=1 0
5pm.introspection.getEntryNML("mpiEnabled", false, "logical", 1)
6mpiEnabled=.false.
7pm.introspection.getEntryNML("description", "This is the description", "string", 1)
8description="This is the description"
9varname =
10value
11
12
13The input varname specification value(s) displayed
14above must be conformable to a MATLAB cell type,
15with a maximum 1 number of elements.
16The specified value has the class:
17
18 class(varname) = string
19
20with size:
21
22 size(varname) = [1, 1]
23
24
25varname =
26 1
27 2
28
29
30The input varname specification value(s) displayed
31above must be conformable to a MATLAB array type,
32with a maximum 1 number of elements.
33The specified value has the class:
34
35 class(varname) = double
36
37with size:
38
39 size(varname) = [2, 1]
40
41


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Joshua Alexander Osborne, May 21 2024, 5:38 PM, University of Texas at Arlington
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin