changeset 9684:c276601410f2 octave-forge

Ensure cells with strings and number are all converted to number
author cdemills
date Tue, 13 Mar 2012 21:57:28 +0000
parents ba7ffe847376
children d02b2b57bce1
files extra/dataframe/inst/@dataframe/private/df_matassign.m
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/extra/dataframe/inst/@dataframe/private/df_matassign.m	Tue Mar 13 21:50:39 2012 +0000
+++ b/extra/dataframe/inst/@dataframe/private/df_matassign.m	Tue Mar 13 21:57:28 2012 +0000
@@ -320,7 +320,8 @@
           if (size (RHS, 1) <= 1)
             switch df._type{indc(indi)}
               case {'char' } %# use a cell array to hold strings
-                dummy = RHS(:, indj);
+                dummy = cellfun (@num2str, RHS(:, indj), \
+                                 'UniformOutput', false);
               case {'double' }
                 dummy = fillfunc (indj);
               otherwise
@@ -333,7 +334,8 @@
             dummy = [];
             switch (df._type{indc(indi)})
               case {'char' } %# use a cell array to hold strings
-                dummy = RHS(:, indj);
+                dummy = cellfun (@num2str, RHS(:, indj), \
+                                 'UniformOutput', false);
               case {'double' }
                 dummy(idxOK, :) = fillfunc (indj); dummy(~idxOK, :) = NA;
               otherwise
@@ -379,7 +381,8 @@
         try     
           switch (df._type{indc(indi)})
             case {'char' } %# use a cell array to hold strings
-              dummy(indr, 1) = RHS(:, indj);
+              dummy(indr, 1) = cellfun(@num2str, RHS(:, indj), \
+                                       'UniformOutput', false);
             case {'double' }
               dummy(indr, :) = fillfunc (indj);
             otherwise