# HG changeset patch # User David Bateman # Date 1272218642 -7200 # Node ID 4f2e46473153764656e5ac35d6e17bfa07ef42bb # Parent 046b713d21dc3d73cd9eba2c6c1d6a030f9fe030 Fix the order of calling setdata and setvertexdata for patches (bug #29549) diff -r 046b713d21dc -r 4f2e46473153 scripts/ChangeLog --- a/scripts/ChangeLog Sun Apr 25 10:04:52 2010 -0400 +++ b/scripts/ChangeLog Sun Apr 25 20:04:02 2010 +0200 @@ -1,3 +1,8 @@ +2010-04-24 David Bateman + + * plot/private/__patch__.m: Correct order of calling setdata and + setvertexdata. + 2010-04-25 Ben Abbott * plot/__go_draw_figure__.m: Hidden axes may have visible children. diff -r 046b713d21dc -r 4f2e46473153 scripts/plot/private/__patch__.m --- a/scripts/plot/private/__patch__.m Sun Apr 25 10:04:52 2010 -0400 +++ b/scripts/plot/private/__patch__.m Sun Apr 25 20:04:02 2010 +0200 @@ -158,12 +158,18 @@ function args = delfields(args, flds) idx = cellfun (@(x) any (strcmpi (x, flds)), args); - idx = idx | [false, idx(1:end-1)]; + if (rows (idx) == 1) + idx = idx | [false, idx(1:end-1)]; + else + idx = idx | [false; idx(1:end-1)]; + endif args (idx) = []; endfunction function args = setdata (args) args = delfields (args, {"xdata", "ydata", "zdata", "cdata"}); + ## Remove the readonly fields as well + args = delfields (args, {"type", "uicontextmenu"}); nargs = length (args); idx = find (cellfun (@(x) strcmpi (x, "faces"), args)) + 1; if (idx > nargs) @@ -233,6 +239,8 @@ function args = setvertexdata (args) args = delfields (args, {"vertices", "faces", "facevertexcdata"}); + ## Remove the readonly fields as well + args = delfields (args, {"type", "uicontextmenu"}); nargs = length (args); idx = find (cellfun (@(x) strcmpi (x, "xdata"), args)) + 1; if (idx > nargs) @@ -307,9 +315,9 @@ recursive = true; f = get (h); if (isfv) - set (h, setvertexdata ([fieldnames(f), struct2cell(f)].'(:)){:}); + set (h, setdata ([fieldnames(f), struct2cell(f)].'(:)){:}); else - set (h, setdata ([fieldnames(f), struct2cell(f)].'(:)){:}); + set (h, setvertexdata ([fieldnames(f), struct2cell(f)].'(:)){:}); endif recursive = false; endif