Mercurial > octave-antonio
annotate scripts/strings/hex2dec.m @ 9051:1bf0ce0930be
Grammar check TexInfo in all .m files
Cleanup documentation sources to follow a few consistent rules.
Spellcheck was NOT done. (but will be in another changeset)
author | Rik <rdrider0-list@yahoo.com> |
---|---|
date | Fri, 27 Mar 2009 22:31:03 -0700 |
parents | eb63fbe60fab |
children | 16f53d29049f |
rev | line source |
---|---|
8920 | 1 ## Copyright (C) 1996, 1999, 2000, 2001, 2005, 2006, 2007, 2008 Daniel Calvelo |
2313 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
2313 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
2268 | 18 |
3361 | 19 ## -*- texinfo -*- |
20 ## @deftypefn {Function File} {} hex2dec (@var{s}) | |
6666 | 21 ## Return the integer corresponding to the hexadecimal number stored |
3361 | 22 ## in the string @var{s}. For example, |
3426 | 23 ## |
3361 | 24 ## @example |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
25 ## @group |
3361 | 26 ## hex2dec ("12B") |
27 ## @result{} 299 | |
28 ## hex2dec ("12b") | |
29 ## @result{} 299 | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
30 ## @end group |
3361 | 31 ## @end example |
3789 | 32 ## |
33 ## If @var{s} is a string matrix, returns a column vector of converted | |
34 ## numbers, one per row of @var{s}. Invalid rows evaluate to NaN. | |
5642 | 35 ## @seealso{dec2hex, base2dec, dec2base, bin2dec, dec2bin} |
3361 | 36 ## @end deftypefn |
2268 | 37 |
3791 | 38 ## Author: Daniel Calvelo <dcalvelo@yahoo.com> |
3789 | 39 ## Adapted-by: Paul Kienzle <pkienzle@kienzle.powernet.co.uk> |
2314 | 40 |
2311 | 41 function d = hex2dec (h) |
2268 | 42 |
43 if (nargin != 1) | |
6046 | 44 print_usage (); |
2268 | 45 else |
3789 | 46 d = base2dec (h, 16); |
2268 | 47 endif |
48 | |
49 endfunction | |
7411 | 50 |
51 %!assert(hex2dec ("12b") == 299 && hex2dec ("12B") == 299); | |
52 | |
53 %!error hex2dec (); | |
54 | |
55 %!error hex2dec ("str", 1); | |
56 |