/usr/share/freemat/toolbox/string/str2num.m is in freemat-data 4.0-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | % STR2NUM STR2NUM Convert a String to a Number
%
% Usage
%
% Converts a string to a number. The general syntax for its use
% is
%
% x = str2num(string)
%
% Here string is the data string, which contains the data to
% be converted into a number. The output is in double precision,
% and must be typecasted to the appropriate type based on what
% you need. Note that by definition, str2num is entirely
% equivalent to eval(['[' string ']'],[]) with all of the
% associated problems where string contains text that causes
% side effects.
function y = str2num(x)
if (~isstr(x))
y = [];
return;
end
try
y = eval(['[',x,']'],'[]');
catch
y = [];
end
|