# HG changeset patch # User Rik # Date 1288830056 25200 # Node ID 4cb1522e4d0fe0da4897e75173e7be0ad680d04f # Parent 0a8e554494c9d30b5ac1ddae4265403f72679d00 Use function handle as input to cellfun, rather than quoted function name or anonymous function wrapper. diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,10 @@ +2010-11-03 Rik + + * general/common_size.m, miscellaneous/private/__xzip__.m, + miscellaneous/what.m, plot/pareto.m, plot/private/__patch__.m: + Use function handle as input to cellfun rather than quoted function + name or anonymous function wrapper. + 2010-11-03 Konstantinos Poulios * plot/axis.m: Making 'axis equal' equivalent to 'daspect([1,1,1])'. diff --git a/scripts/general/common_size.m b/scripts/general/common_size.m --- a/scripts/general/common_size.m +++ b/scripts/general/common_size.m @@ -53,7 +53,7 @@ endif ## Find scalar args. - nscal = cellfun ("numel", varargin) != 1; + nscal = cellfun (@numel, varargin) != 1; i = find (nscal, 1); diff --git a/scripts/miscellaneous/private/__xzip__.m b/scripts/miscellaneous/private/__xzip__.m --- a/scripts/miscellaneous/private/__xzip__.m +++ b/scripts/miscellaneous/private/__xzip__.m @@ -115,7 +115,7 @@ [d, f, ext] = cellfun (@(x) fileparts (x), files, "UniformOutput", false); f = cellfun (@(x, y) sprintf ("%s%s", x, y), f, ext, "UniformOutput", false); - idx = cellfun (@(x) isdir (x), files); + idx = cellfun (@isdir, files); d(idx) = ""; f(idx) = files(idx); endfunction diff --git a/scripts/miscellaneous/what.m b/scripts/miscellaneous/what.m --- a/scripts/miscellaneous/what.m +++ b/scripts/miscellaneous/what.m @@ -91,7 +91,7 @@ if (length (f) > 0) printf ("%s %s:\n\n", msg, p) - maxlen = max (cellfun (@(x) length (x), f)); + maxlen = max (cellfun (@length, f)); ncols = max (1, floor (terminal_size()(2) / (maxlen + 3))); fmt = ""; for i = 1: ncols diff --git a/scripts/plot/pareto.m b/scripts/plot/pareto.m --- a/scripts/plot/pareto.m +++ b/scripts/plot/pareto.m @@ -66,11 +66,11 @@ if (ischar (y)) y = cellstr (y); else - y = cellfun (@(x) num2str (x), num2cell (y), "UniformOutput", false); + y = cellfun (@num2str, num2cell (y), "UniformOutput", false); endif endif else - y = cellfun (@(x) int2str (x), num2cell (1 : numel(x)), + y = cellfun (@int2str, num2cell (1 : numel(x)), "UniformOutput", false); endif diff --git a/scripts/plot/private/__patch__.m b/scripts/plot/private/__patch__.m --- a/scripts/plot/private/__patch__.m +++ b/scripts/plot/private/__patch__.m @@ -171,25 +171,25 @@ ## Remove the readonly fields as well args = delfields (args, {"type", "uicontextmenu"}); nargs = length (args); - idx = find (cellfun (@(x) strcmpi (x, "faces"), args))(end) + 1; + idx = find (strcmpi (args, "faces"), 1, "last") + 1; if (idx > nargs) faces = []; else faces = args {idx}; endif - idx = find (cellfun (@(x) strcmpi (x, "vertices"), args))(end) + 1; + idx = find (strcmpi (args, "vertices"), 1, "last") + 1; if (idx > nargs) vert = []; else vert = args {idx}; endif - idx = find (cellfun (@(x) strcmpi (x, "facevertexcdata"), args), 1, "last") + 1; + idx = find (strcmpi (args, "facevertexcdata"), 1, "last") + 1; if (isempty(idx) || idx > nargs) fvc = []; else fvc = args {idx}; endif - idx = find (cellfun (@(x) strcmpi (x, "facecolor"), args), 1, "last") + 1; + idx = find (strcmpi (args, "facecolor"), 1, "last") + 1; if (isempty(idx) || idx > nargs) if (!isempty (fvc)) fc = "flat"; @@ -238,31 +238,31 @@ ## Remove the readonly fields as well args = delfields (args, {"type", "uicontextmenu"}); nargs = length (args); - idx = find (cellfun (@(x) strcmpi (x, "xdata"), args))(end) + 1; + idx = find (strcmpi (args, "xdata"), 1, "last") + 1; if (idx > nargs) x = []; else x = args {idx}; endif - idx = find (cellfun (@(x) strcmpi (x, "ydata"), args))(end) + 1; + idx = find (strcmpi (args, "ydata"), 1, "last") + 1; if (idx > nargs) y = []; else y = args {idx}; endif - idx = find (cellfun (@(x) strcmpi (x, "zdata"), args))(end) + 1; + idx = find (strcmpi (args, "zdata"), 1, "last") + 1; if (isempty(idx) || idx > nargs) z = []; else z = args {idx}; endif - idx = find (cellfun (@(x) strcmpi (x, "cdata"), args))(end) + 1; + idx = find (strcmpi (args, "cdata"), 1, "last") + 1; if (isempty(idx) || idx > nargs) c = []; else c = args {idx}; endif - idx = find (cellfun (@(x) strcmpi (x, "facecolor"), args))(end) + 1; + idx = find (strcmpi (args, "facecolor"), 1, "last") + 1; if (isempty(idx) || idx > nargs) if (!isempty (c)) fc = "flat";