functions () fails for subfunctions

Moritz Borgmann octave at moriborg.de
Sun May 4 11:53:13 CDT 2008


The following works in Matlab:

===
function testfun ()

f = str2func ('testsubfun');
functions (f)


function [x, y] = testsubfun (x, y)
% noop
===

it outputs:

ans =

      function: 'testsubfun'
          type: 'scopedfunction'
          file: [1x85 char]
     parentage: {'testsubfun'  'testfun'}

whereas in Octave (current hg default), it results in an error:

octave:1> testfun ()
error: invalid structure assignment
error: called from `testfun' in file `......./testfun.m'
error: evaluating assignment expression near line 1, column 3

Now it's probably not that important that the Matlab functionality is 
copied exactly, especially since the format of the output is 
officially unspecified, but at least it shouldn't throw an error.

-M


More information about the Bug-octave mailing list