ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
isnumeric.m
Go to the documentation of this file.
1%> \brief
2%> Return a scalar MATLAB logical that is ``true`` if and
3%> only if the input string can be converted to a **scalar** number.<br>
4%>
5%> \details
6%> The returned result is ``~isnan(str2double(str))``.<br>
7%> This is different from the result returned by
8%> the MATLAB intrinsic ``isnumeric()``.<br>
9%>
10%> \param[in] str : The input scalar MATLAB string
11%> whose conversion to numeric value is to be tested.<br>
12%>
13%> \return
14%> ``itis`` : The output scalar MATLAB logical that is ``true`` if and
15%> only if the input ``str`` contains text that is convertible
16%> to a **scalar** number, e.g., integer, real, complex.<br>
17%>
18%> \interface{isnumeric}
19%> \code{.m}
20%>
21%> itis = pm.str.isnumeric(str)
22%>
23%> \endcode
24%>
25%> \example{isnumeric}
26%> \include{lineno} example/str/isnumeric/main.m
27%> \output{isnumeric}
28%> \include{lineno} example/str/isnumeric/main.out.m
29%>
30%> \final{isnumeric}
31%>
32%> \author
33%> \JoshuaOsborne, May 21 2024, 4:36 AM, University of Texas at Arlington<br>
34%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
35%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
36function itis = isnumeric(str)
37 itis = ~isnan(str2double(str));
38end
function isnumeric(in str)
Return a scalar MATLAB logical that is true if and only if the input string can be converted to a sca...