octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: goals for 3.1


From: David Bateman
Subject: Re: goals for 3.1
Date: Thu, 20 Mar 2008 19:21:49 +0100
User-agent: Thunderbird 2.0.0.12 (X11/20080306)

John W. Eaton wrote:
> On 20-Mar-2008, David Bateman wrote:
> 
> | John W. Eaton wrote:
> | > I'm not sure about additional fucntions but in addition to working on
> | > numeric data, these functionns should also work on character, struct,
> | > and cell arrays.
> | >
> | >   
> | 
> | There is a compatibility issue with the triu, tril and diag functions
> | with structure arrays between Octave and Matlab. Basically Matlab
> | doesn't allow structure arrays with these functions, but Octave does..
> | However what is returned by Octave doesn't really make any sense.. Consider
> | 
> |  d =  triu (struct ('fld',num2cell([1,2;3,4])))
> |  d(2,1).fld
> | 
> | The triu on the struct returns the cell (2,1) with an empty octave-value
> | and so d(2,1).fld returns nothing. This is quite a surprising and
> | probably useless feature.. Similar issues exist in tril and diag. Should
> | we keep this feature, it which case it should be documented, or should
> | we just fail for structures like Matlab does?
> 
> Yes, since there is no "0" for structure arrays, probably we should
> not expect these functions to work for structs.  For cell arrays, we
> could make them work if we agree that "[]" is the "0" for cells.
> I.e., given
> 
>   x = {1, 2, 3};
> 
> the function call
> 
>   diag (x)
> 
> would produce
> 
>   { 1, [], [];
>    [],  2, [];
>    [], [],  3 }
> 
> I think this is compatible behavior.
> 
> jwe
> 


That is what I just implemented.. Will send a patch after I feed the
kids ...

D.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]