[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: find first and last
From: |
Bill Denney |
Subject: |
Re: find first and last |
Date: |
Tue, 26 Sep 2006 14:50:38 -0400 (EDT) |
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.
Bill
--
"If you're so special, why aren't you dead?" -- The Breeders
find.diff
Description: Text document
- find first and last, Bill Denney, 2006/09/25
- find first and last, John W. Eaton, 2006/09/26
- Re: find first and last, Bill Denney, 2006/09/26
- Re: find first and last, David Bateman, 2006/09/26
- Re: find first and last, Bill Denney, 2006/09/26
- Re: find first and last, John W. Eaton, 2006/09/26
- Re: find first and last,
Bill Denney <=
- Re: find first and last, John W. Eaton, 2006/09/26
- Re: find first and last, John W. Eaton, 2006/09/26
- Re: find first and last, David Bateman, 2006/09/26
- Re: find first and last, John W. Eaton, 2006/09/27
- Re: find first and last, David Bateman, 2006/09/27
- Re: find first and last, David Bateman, 2006/09/27
- Re: find first and last, John W. Eaton, 2006/09/27