help-octave
[Top][All Lists]
Advanced

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

Re: counting totals in square grids (meshgrid)


From: Jaroslav Hajek
Subject: Re: counting totals in square grids (meshgrid)
Date: Mon, 14 Dec 2009 10:40:05 +0100

On Mon, Dec 14, 2009 at 10:30 AM, Isak Delberth Davids
<address@hidden> wrote:
> Yes --- thanks I could not expressed it better --- thats what I want.
> Indeed, x=0 and x<1 is tautology, I should have written x>=0 and x<1.
> I can now do this:
>
> for i = 1:n
>        for j = 1:n
>                grid(i,j) = sum (i-1 <= x & x < i & j-1 <= y & y < j)
>        end
> end
>

OK. There are ways to do this operation more efficiently, but let's
put that off for now. I suggest you add a semicolon to the assignment
in order to suppress output at each iteration.

> Now, how will I extract the total x values in a given grid? I fail to
> get the index k into the picture!
>

Sorry, I don't understand what you're asking. I'm a mathematician, not
a magician (sigh), so you'll either need to formulate your questions
precisely, or wait for someone with more telepathic capabilities.


-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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