Mercurial > hg > octave-nkf
comparison scripts/miscellaneous/setfield.m @ 12931:cefd568ea073
Replace function handles with function names in cellfun calls for 15% speedup.
* accumarray.m arrayfun.m, blkdiag.m, cell2mat.m, common_size.m, interp3.m,
interpn.m, __isequal__.m, structfun.m, voronoi.m, strread.m, fullfile.m,
getfield.m, __xzip__.m, setfield.m, what.m, pkg.m, axis.m, pareto.m,
__ghostscript__.m, __go_draw_axes__.m, __patch__.m, refreshdata.m, whitebg.m,
lcm.m, index.m, strcat.m, strmatch.m, validatestring.m: Replace function
handles in calls to cellfun with double quoted function names.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sat, 06 Aug 2011 18:03:18 -0700 |
parents | fd0a3ac60b0e |
children | 72c96de7a403 |
comparison
equal
deleted
inserted
replaced
12930:7bd29d875af1 | 12931:cefd568ea073 |
---|---|
48 if (nargin < 3) | 48 if (nargin < 3) |
49 print_usage (); | 49 print_usage (); |
50 endif | 50 endif |
51 subs = varargin(1:end-1); | 51 subs = varargin(1:end-1); |
52 rhs = varargin{end}; | 52 rhs = varargin{end}; |
53 flds = cellfun (@ischar, subs); | 53 flds = cellfun ("isclass", subs, "char"); |
54 idxs = cellfun (@iscell, subs); | 54 idxs = cellfun ("isclass", subs, "cell"); |
55 if (all (flds | idxs)) | 55 if (all (flds | idxs)) |
56 typs = merge (flds, {"."}, {"()"}); | 56 typs = merge (flds, {"."}, {"()"}); |
57 obj = subsasgn (obj, struct ("type", typs, "subs", subs), rhs); | 57 obj = subsasgn (obj, struct ("type", typs, "subs", subs), rhs); |
58 else | 58 else |
59 error ("setfield: invalid index"); | 59 error ("setfield: invalid index"); |