[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: counting totals in square grids (meshgrid)
From: |
Isak Delberth Davids |
Subject: |
Re: counting totals in square grids (meshgrid) |
Date: |
Mon, 14 Dec 2009 10:12:10 +0000 |
I see, that last question of mine was really not needed, because value
of grid(i,j) is exactly equal to the number of elements that are in
the i-j-th grid. What more do I want there? My question was unclear
and aboveall, it was unnecessary. Jaroslav, thanks for the assistance!
Now back to improving the efficiency of the lines:
for i = 1:n
for j = 1:n
grid(i,j) = sum (i-1 <= x & x < i & j-1 <= y & y < j);
end
end
Do you have a suggestion?
isak.davids
________________________
2009/12/14 Jaroslav Hajek <address@hidden>:
> 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
>
--
***************************************************
***************************************************
FULL NAME: Isak Delbert Davids
LOCATION: mostly within 10cm of a keybord
CONTACTS: do not use contact lenses yet
FAX: still has a paper jam
"Views and opinions expressed by my person, are not necessarily true
--- they are simply my views and opinions"
***************************************************
***************************************************
- counting totals in square grids (meshgrid), Isak Delberth Davids, 2009/12/14
- Re: counting totals in square grids (meshgrid), Jaroslav Hajek, 2009/12/14
- Re: counting totals in square grids (meshgrid), Isak Delberth Davids, 2009/12/14
- Re: counting totals in square grids (meshgrid), Jaroslav Hajek, 2009/12/14
- Re: counting totals in square grids (meshgrid), Isak Delberth Davids, 2009/12/14
- Re: counting totals in square grids (meshgrid), Jaroslav Hajek, 2009/12/14
- Re: counting totals in square grids (meshgrid), Isak Delberth Davids, 2009/12/14
- Re: counting totals in square grids (meshgrid), Jaroslav Hajek, 2009/12/14
- Re: counting totals in square grids (meshgrid),
Isak Delberth Davids <=
- Re: counting totals in square grids (meshgrid), Jaroslav Hajek, 2009/12/14
- Re: counting totals in square grids (meshgrid), Isak Delberth Davids, 2009/12/14