From: <cde...@us...> - 2010-12-13 22:18:06
|
Revision: 8020 http://octave.svn.sourceforge.net/octave/?rev=8020&view=rev Author: cdemills Date: 2010-12-13 22:17:59 +0000 (Mon, 13 Dec 2010) Log Message: ----------- Fixed a few oddities occurring when the target structure is empty Modified Paths: -------------- trunk/octave-forge/extra/dataframe/inst/@dataframe/display.m trunk/octave-forge/extra/dataframe/inst/@dataframe/permute.m trunk/octave-forge/extra/dataframe/inst/@dataframe/sort.m trunk/octave-forge/extra/dataframe/inst/@dataframe/subsref.m Modified: trunk/octave-forge/extra/dataframe/inst/@dataframe/display.m =================================================================== --- trunk/octave-forge/extra/dataframe/inst/@dataframe/display.m 2010-12-13 17:13:29 UTC (rev 8019) +++ trunk/octave-forge/extra/dataframe/inst/@dataframe/display.m 2010-12-13 22:17:59 UTC (rev 8020) @@ -165,8 +165,12 @@ if (!isempty(dummy{3, 2})), indi = ~cellfun('isempty', dummy{3, 2}); if (any(indi)), - resu = horzcat(resu, vspace, strjust(char(dummy{2, 2}, dummy{3, 2}),\ - 'right')); + try + resu = horzcat(resu, vspace, strjust(char(dummy{2, 2}, dummy{3, 2}),\ + 'right')); + catch + disp('line 172 '); keyboard + end_try_catch endif endif Modified: trunk/octave-forge/extra/dataframe/inst/@dataframe/permute.m =================================================================== --- trunk/octave-forge/extra/dataframe/inst/@dataframe/permute.m 2010-12-13 17:13:29 UTC (rev 8019) +++ trunk/octave-forge/extra/dataframe/inst/@dataframe/permute.m 2010-12-13 22:17:59 UTC (rev 8020) @@ -26,7 +26,11 @@ resu = dataframe([]); - resu._cnt = df._cnt(perm); + if (length(df._cnt) >= length(perm)), + resu._cnt = df._cnt(perm); + else + resu._cnt = [df._cnt 1](perm); + endif if (ndims(df._ridx) < 3), resu._ridx = permute(df._ridx, [min(perm(1), 2) min(perm(2:end))]); @@ -34,7 +38,7 @@ resu._ridx = permute(df._ridx, perm); endif - if (perm(1) > 1), + if (2 == perm(1)), resu._name{1} = df._name{2}; resu._over{1} = df._over{2}; else @@ -56,7 +60,7 @@ resu._over{1}(1, indc + (1:indi)) = true; endif - if (perm(2) > 1), + if (2 == perm(2)), resu._name{2} = df._name{2}; resu._over{2} = df._over{2}; else Modified: trunk/octave-forge/extra/dataframe/inst/@dataframe/sort.m =================================================================== --- trunk/octave-forge/extra/dataframe/inst/@dataframe/sort.m 2010-12-13 17:13:29 UTC (rev 8019) +++ trunk/octave-forge/extra/dataframe/inst/@dataframe/sort.m 2010-12-13 22:17:59 UTC (rev 8020) @@ -117,10 +117,12 @@ resu._data{indi} = squeeze(resu._data{indi}); resu._rep{indi} = 1:size(resu._data{indi}, 2); endfor - if all([1 == size(idx, 2) 1 == size(idx, 3)]), - resu._ridx = resu._ridx(idx, :); - resu._name{1, 1} = resu._name{1, 1}(idx); - resu._over{1, 1} = resu._over{1, 1}(idx); + if (all([1 == size(idx, 2) 1 == size(idx, 3)])), + resu._ridx = resu._ridx(idx, :); + if (!isempty(resu._name{1, 1})), + resu._name{1, 1} = resu._name{1, 1}(idx); + resu._over{1, 1} = resu._over{1, 1}(idx); + endif else %# data where mixed resu._ridx = idx; Modified: trunk/octave-forge/extra/dataframe/inst/@dataframe/subsref.m =================================================================== --- trunk/octave-forge/extra/dataframe/inst/@dataframe/subsref.m 2010-12-13 17:13:29 UTC (rev 8019) +++ trunk/octave-forge/extra/dataframe/inst/@dataframe/subsref.m 2010-12-13 22:17:59 UTC (rev 8020) @@ -247,7 +247,12 @@ case {'dataframe'} S(1).subs{1} = subsindex(S(1).subs{1}, 1); endswitch - + + if (isempty(S(1).subs{1})), + resu = df_colmeta(df); + return; + endif + if (!isempty(fullindr)), %# convert linear index to subscripts if (length(df._cnt) <= 2), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |