octave-maintainers
[Top][All Lists]
Advanced

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

syntax of find


From: Thorsten Meyer
Subject: syntax of find
Date: Sat, 06 Jun 2009 23:34:45 +0200
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

In the documentation of cs-lists I find the following example:

x = ceil (randn (10, 1));
in = struct ("call1", {x, Inf, "last"},
             "call2", {x, Inf, "first"});
out = struct ("call1", cell (2, 1), "call2", cell (2, 1));
[out.call1] = find (in.call1);
[out.call2] = find (in.call2);

With the current tip, it fails, because octave tries to allocate for an
infinitely large return vector. I guess, that at some point, "inf" as the second
input argument to find meant "all". By experimenting, I found that giving a
negative number (or even -inf) instead of Inf will find all nonzero elements 
now.

Is that compatible behaviour?

What does matlab say to

find([1, 0, 1, 0, 1], -1, "last")

and

find([1, 0, 1, 0, 1], inf, "last")

?

Thanks

Thorsten



reply via email to

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