# HG changeset patch # User John W. Eaton # Date 1247166747 14400 # Node ID e9f1329ed504da50e880df21e6643e5fcd48a68b # Parent 69d05d1a63b990654aa6f3d92916aabf2ac4d403 nonzeros: always return a column vector diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-07-09 John W. Eaton + + * sparse/nonzeros.m: Always return a column vector. New tests. + 2009-06-25 Ben Abbott * plot/gnuplot_drawnow.m: Apply feature 'wxt_has_size'. diff --git a/scripts/sparse/nonzeros.m b/scripts/sparse/nonzeros.m --- a/scripts/sparse/nonzeros.m +++ b/scripts/sparse/nonzeros.m @@ -28,7 +28,12 @@ endif [i, j, t] = find (s); + + t = t(:); + endfunction %!assert(nonzeros([1,2;3,0]),[1;3;2]) +%!assert(nonzeros([1,2,3,0]),[1;3;2]) %!assert(nonzeros(sparse([1,2;3,0])),[1;3;2]) +%!assert(nonzeros(sparse([1,2,3,0])),[1;3;2])