functions () fails for subfunctions

John W. Eaton jwe at bevo.che.wisc.edu
Sun May 4 22:47:46 CDT 2008


On  4-May-2008, Moritz Borgmann wrote:

| 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.

I checked in the following change.  With it, I see

  octave:1> testfun
  ans =
  {
    function = testsubfun
    type = subfunction
    parentage =

    {
      [1,1] = testsubfun
      [1,2] = testfun
    }

    file = /scratch/jwe/build/octave/testfun.m
  }

jwe


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080504/4aab9658/attachment.ksh 


More information about the Bug-octave mailing list