changeset 14409:e3dbcb75f557

maint: periodic merge of stable to default.
author Rik <octave@nomad.inbox5.com>
date Sat, 25 Feb 2012 10:14:15 -0800
parents 98cf8aa9f8ba (current diff) 73f02881260f (diff)
children f3c958ae393d
files NEWS scripts/strings/base2dec.m
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Fri Feb 24 18:16:35 2012 -0800
+++ b/NEWS	Sat Feb 25 10:14:15 2012 -0800
@@ -46,7 +46,7 @@
     http://forge.scilab.org/index.php/p/arpack-ng
 
  ** Many of Octave's binary operators (.*, .^, +, -, ...) now perform
-    automatic broadcasting for array operations that allows you to use
+    automatic broadcasting for array operations which allows you to use
     operator notation instead of calling bsxfun or expanding arrays (and
     unnecessarily wasting memory) with repmat or similar idioms.  For
     example, to scale the columns of a matrix by the elements of a row
@@ -108,7 +108,7 @@
 
     negative binomial function has been extended to real, non-integer
     inputs.  The discrete_inv fucntion now returns v(1) for 0 instead of
-    NaN.  The nbincdf fucntion has bbeen recoded to use a closed form
+    NaN.  The nbincdf fucntion has been recoded to use a closed form
     solution with betainc.
 
  ** strread, textscan, and textread have been completely revamped.
--- a/scripts/strings/base2dec.m	Fri Feb 24 18:16:35 2012 -0800
+++ b/scripts/strings/base2dec.m	Sat Feb 25 10:14:15 2012 -0800
@@ -89,7 +89,7 @@
   table = NaN (1, 256);
   table(toascii (symbols(1:base))) = 0 : base-1;
   table(toascii (" ")) = 0;
-  s = table(toascii (s));
+  s = reshape (table(toascii (s)), size (s));
 
   ## Multiply the resulting digits by the appropriate power
   ## and sum the rows.
@@ -103,6 +103,9 @@
 %!assert (base2dec ("-1", 2), NaN)
 %!assert (base2dec ({"A1", "1A"}, 16), [161; 26])
 
+%% Bug #35621
+%!assert (base2dec (["0"; "1"], 2), [0; 1])
+
 %%Test input validation
 %!error base2dec ()
 %!error base2dec ("11120")