Error - "some elements undefined in return list"

John W. Eaton jwe at bevo.che.wisc.edu
Mon Dec 3 16:31:48 CST 2007


On  4-Dec-2007, nit ar wrote:

| Hello John,
| 
| Sorry for the previous message.
| I will try to describe again the error/bug.
| 
| I am running MSVC ver 2.9.16 and encountering an error when a function is called from a script and returns its output variables into new fields of already existing structure.
| 
| It can be demonstrated by the following test function testf.m and test script test.m
| 
| Please save the following code (5 lines) as function file testf.m:
| 
| function [c1,c2]=testf(n1,n2)
| c1.a=n1;
| c1.b=n2;
| c2.a=n1;
| c2.b=n2;
| 
| Please save the following code (4 lines) as script file test.m (the script lines can be run also directly on the console):
| 
| d.a=1;
| d.b=2;
| [d.c.a,d.c.b]=testf(1,2);
| [d.ca.a,d.ca.b]=testf(1,2);
| 
| Explanation of the demonstration script:
| The structure d and fields a,b are defined by simple values assigment
| The function is called  successfully, addind c.a and c.b as new fields of structure d
| The function is called again trying to add ca.a and ca.b as new fields of structure d and gives an error
| 
| When I am running the above test script in the console, I getting the following error message:
| 
| octave.exe:5> test
| error: some elements undefined in return
| list
| error: evaluating assignment expression near line 4, column
| 16
| error: near line 4 of file `c:\Documents and Settings\user\My
| Documents\test\test.m'
| 
| When I am typing d in the console trying to display d contents, I am getting the following display where a.ca.a is displayed with some extra ',' has an erroneous  contents and strange display 
| 
| octave.exe:4> d
| d =
| {
|   a =  1
|   b =  2
|   c =
|   {
|     a =
|     {
|       a: 1x1 scalar
|       b: 1x1 scalar
|     }
| 
|     b =
|     {
|       a: 1x1 scalar
|       b: 1x1 scalar
|     }
| 
|   }
| 
|   ca =
|   {
|     a =
| 
|     (,
|       [1] =
|       {
|         a: 1x1 scalar
|         b: 1x1 scalar
|       }
| 
|       [2] =
|       {
|         a: 1x1 scalar
|         b: 1x1 scalar
|       }
| 
|     ,)
| 
|   }
| 
| }
| 
| 
| The test script above has two calls to testf just to demonstrate the the first call runs successfully but the second fails. The error can be more easily reproduced by running line 1 and line 4 of the test script directly from the console (memory should be cleared first).
| 
| However, starting with all variables cleared, running line 4 by itself from the console does not produce the error ! Running line 4 again produce an error !
| 
| More than that - running line 1 and line 3 also does no produce the error ! The only difference between line 3 and line 4 is that the structure fields names have more than a single character !
| 
| I am maintaining a complex simulation project which runs on both Octave and Matlab and I have eliminated the above example out of the 'parameters handling' portion of the simulation which use some functions to read contents of certain fields of a structure. The above example runs on Matlab without any problem and the introduced error, is causing me problems attempting to maintain common code for both Matlab and Octave.

I can't seem to reproduce the problem with 2.9.17 or a build from the
current Octave sources.

jwe


More information about the Bug-octave mailing list