diff scripts/strings/str2num.m @ 8442:502e58a0d44f

Fix docstrings, add examples, references and tests to string functions
author Thorsten Meyer <thorsten.meyier@gmx.de>
date Mon, 05 Jan 2009 08:11:03 +0100
parents 83a8781b529d
children eb63fbe60fab
line wrap: on
line diff
--- a/scripts/strings/str2num.m	Tue Dec 30 00:25:20 2008 -0500
+++ b/scripts/strings/str2num.m	Mon Jan 05 08:11:03 2009 +0100
@@ -18,7 +18,26 @@
 
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {} str2num (@var{s})
-## Convert the string @var{s} to a number.
+## Convert the string (or character array) @var{s} to a number (or an
+## array). Examples:  
+##
+## @example
+## @group
+## str2num("3.141596")
+##      @result{} 3.141596
+## 
+## str2num(["1, 2, 3"; "4, 5, 6"]);
+##      @result{} ans =
+##         1  2  3
+##         4  5  6
+## @end group
+## @end example
+## 
+## @strong{Caution:} As @code{str2num} uses the @code{eval} function
+## to do the conversion, @code{str2num} will execute any code contained
+## in the string @var{s}.  Use @code{str2double} instead if you want to
+## avoid the use of @code{eval}. 
+## @seealso{str2double, eval}
 ## @end deftypefn
 
 ## Author: jwe