octave-maintainers
[Top][All Lists]
Advanced

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

Re: find first and last


From: John W. Eaton
Subject: Re: find first and last
Date: Tue, 26 Sep 2006 17:38:13 -0400

On 26-Sep-2006, Bill Denney wrote:

| On Tue, 26 Sep 2006, John W. Eaton wrote:
| 
| > Running under gdb can also be helpful.  I think you are forgetting
| > that arrays in C++ use 0-based indexing, even with liboctave objects.
| > So if nargin > 1, you can safely access args(0) and args(1), but there
| > is no guarantee about args(2).
| 
| That was it.  Thanks.  I work on m files too much to remember that.  Here 
| is a version that is more efficient, and it should actually be more 
| efficient for any matrix because it will only search the required range.
| 
| So, now for find(1:50 > 48) instead of going through 1:50 twice, it will 
| only go through 1:50 once and the second time it will only look at 49 and 
| 50.
| 
| Hopefully this doesn't introduce any new bugs.

It seems to work for me except that

  [i,j,v] = find (...)

does not work correctly now.  I fixed that and checked in your patch
with a few other minor changes.

Thanks,

jwe


reply via email to

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