Mercurial > pytave
diff @pyobject/fieldnames.m @ 298:df1bddece9d5
Use subsref in "cell" method for casting to cell
Remove custom loop and replace it with call to improved subsref.
* @pyobject/cell.m: Use subsref instead of loop.
* changed @pyobject/fieldnames.m: Use cell.
* changed @pyobject/methods.m: Use cell.
author | Colin Macdonald <cbm@m.fsf.org> |
---|---|
date | Wed, 03 Aug 2016 20:33:33 -0700 |
parents | 510ed59a61d3 |
children | 2047beb75f5e |
line wrap: on
line diff
--- a/@pyobject/fieldnames.m Wed Aug 03 20:22:42 2016 -0700 +++ b/@pyobject/fieldnames.m Wed Aug 03 20:33:33 2016 -0700 @@ -53,14 +53,7 @@ " and not a.startswith('_')]"]); names_obj = pycall (cmd, x); - ## FIXME: names = cellfun (@char, cell (names_obj), "uniformoutput", false); - len = length (names_obj); - names = cell (len, 1); - if (len > 0) - idx = struct ("type", "{}", "subs", {{1:len}}); - [names{1:len}] = subsref (names_obj, idx); - names = cellfun (@char, names, "uniformoutput", false); - endif + names = cellfun (@char, cell (names_obj), "uniformoutput", false); endfunction