2%> Verify the type and number of elements of the input ``varval``
3%> match the specified input ``vartype`` and ``varsize``.<br>
4%> Otherwise, halt the program by calling the MATLAB
5%> intrinsic ``error()`` with an appropriate
6%> descriptive error message.<br>
9%> This function is merely a higher-level wrapper around
10%> the ParaMonte functionality [pm.introspection.istype()](@ref
istype).<br>
11%> The goal is to offer a unified interface
for argument verification and
12%> aborting the program with a suitable error message
if
13%> the verification fails.<br>
15%> \param[in] varval : The input value to whose type and
16%> number of elements is to be verified.
17%> \param[in] vartype : See the documentation of the corresponding
18%> argument of [pm.introspection.istype()](@ref
istype).
19%> \param[in] varsize : See the documentation of the corresponding
20%> argument of [pm.introspection.istype()](@ref
istype).
21%> \param[in] varname : The input scalar MATLAB
string containing the label to assign
22%> to the namelist-converted value in the output ``entry``.<br>
23%> The specified value of ``varname`` will be trimmed
24%> (to remove leading and trailing blanks) and used
25%> only
for outputting an error message.<br>
26%> (**optional**,
default = ``
"value"``)
31%> pm.introspection.verify(varval, vartype, varsize);
32%> pm.introspection.verify(varval, vartype, varsize, varname);
37%> \include{lineno} example/introspection/
verify/main.m
39%> \include{lineno} example/introspection/
verify/main.out.m
44%> \JoshuaOsborne, May 21 2024, 5:42 PM, University of Texas at Arlington<br>
45%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
46%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
47function
verify(varval, vartype, varsize, varname)
51 varname = string(strtrim(varname));
54 if ~pm.introspection.istype(varval, vartype, varsize)
55 disp(varname +
" = ");
58 +
"The input ``" + varname +
"`` specification value(s) displayed" + newline ...
59 +
"above must be conformable to a MATLAB " + vartype +
" type," + newline ...
60 +
"with a maximum " +
string(varsize) +
" number of elements." + newline ...
61 +
"The specified value has the class:" + newline ...
63 + pm.io.tab +
"class(" + varname +
") = " +
string(
class(varval)) + newline ...
65 +
"with size:" + newline ...
67 + pm.io.tab +
"size(" + varname +
") = [" + join(
string(size(varval)),
", ") +
"]" + newline ...
function verify(in varval, in vartype, in varsize, in varname)
Verify the type and number of elements of the input varval match the specified input vartype and vars...
function istype(in varval, in vartype, in varsize)
Return true if and only if the input varval conforms with the specified input type vartype and the sp...