goals for 3.1
John W. Eaton
jwe at bevo.che.wisc.edu
Thu Mar 20 12:37:45 CDT 2008
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
More information about the Octave-maintainers
mailing list