octave-maintainers
[Top][All Lists]
Advanced

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

Request for indexing fix


From: John W. Eaton
Subject: Request for indexing fix
Date: Wed, 13 Jun 2007 19:47:30 -0400

On 14-Jun-2007, David Bateman wrote:

| Matlab allows the following code
| 
| x = randn(2,2,2);
| idx(1:3) = {1};
| idx(1) =';';
| x(idx{:})
| 
| This is a really nice feature and I used it in the spline code I
| committed. However, it seems that Octave doesn't allow this, and so the
| ND spline code is in fact partially broken. I therefore suggest the
| attached patch. One point however is that this means that x(':',1,1)
| will give the same result, and without access to matlab at the moment
| I'm unsure what matlab in fact does in this case.

I was hoping that indexing with char variables only worked for the
special case of ':', but unfortunately not.  Compare

  x = 1:100;

  x(char (57))  -->  57
  x(char (58))  -->  1:100

It seems like another "diag" problem to me.  Did they really think
this through before they implemented it?  So although it may seem
convenient in some instances, I have to disagree that this is a nice
feature.

If it is necessary to have, then I suppose we can do it and I think
your patch is sufficient.  If there are any complaints about it (maybe
there will be none, which is probably what the MathWorks were betting
on) we can just say "blame Matlab".

jwe


reply via email to

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