octave-maintainers
[Top][All Lists]
Advanced

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

Re: f(end) feature?


From: Paul Kienzle
Subject: Re: f(end) feature?
Date: Tue, 31 Dec 2002 17:07:43 -0500
User-agent: Mutt/1.2.5.1i

On Tue, Dec 31, 2002 at 03:47:02PM -0600, John W. Eaton wrote:
> On 31-Dec-2002, Paul Kienzle <address@hidden> wrote:
> 
> | So I guess the following is out of the question:
> | 
> |     function y = head(x)
> |         y = x(1:min(3,end));
> |     end
> 
> Sorry, that's not what I intended, and it's not actually prevented by
> the previous patch, but min(3,end) would return -1, so you would not
> get the result you expect.  The following patch should help (I think).
> 
> With it and the previous patch:
> 
>   octave:1> function y = head (x) y = x(1:min(3,end)); end
>   octave:2> x = [1,2,3,4]
>   x =
> 
>     1  2  3  4
> 
>   octave:3> head (x)
>   ans =
> 
>     1  2  3
> 
> and
> 
>   octave:1> min (1,end)
>   error: __end__: internal error
>   error: evaluating argument list element number 2
> 
> 
> Is that better?

I'm impressed!  I still haven't figured out how you've done it.  Maybe
one day I'll give up and peek at the code.

- Paul



reply via email to

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