Re: Someone can help me please? [message #77027] |
Tue, 26 July 2011 04:10 |
Giacinto M
Messages: 2 Registered: July 2011
|
Junior Member |
|
|
On 26 Lug, 13:02, Wox <s...@nomail.com> wrote:
> On Tue, 26 Jul 2011 02:51:25 -0700 (PDT), Giacinto M
>
> <ilgio1...@gmail.com> wrote:
>> Hello! I'm a beginner user of IDL,
>> I have a little problem that I can't solve, can you help me?:
>
>> From a 3D array, I want to look on the 3rd dimension (z) of each
>> coordinate (x,y) of the array and count
>> the number of time that I can found a specific number:
>
>> for example:
>> arr=[[[0,1],[2,1]],[[2,2],[1,1]],[[0,1],[0,0]],[[1,1],[1,1]] ] -
>>> number 1 appear 3 times on arr(x0,y1)
>
>> How can I do this?
>> Thanks
>
> print,total(arr eq 1,3,/int)
>
> where "1" is the number you are looking for and "3" the dimension you
> are looking at.
Fantastic! many thanks Wox
|
|
|
Re: Someone can help me please? [message #77028 is a reply to message #77027] |
Tue, 26 July 2011 04:02  |
Wout De Nolf
Messages: 194 Registered: October 2008
|
Senior Member |
|
|
On Tue, 26 Jul 2011 02:51:25 -0700 (PDT), Giacinto M
<ilgio1984@gmail.com> wrote:
> Hello! I'm a beginner user of IDL,
> I have a little problem that I can't solve, can you help me?:
>
> From a 3D array, I want to look on the 3rd dimension (z) of each
> coordinate (x,y) of the array and count
> the number of time that I can found a specific number:
>
> for example:
> arr=[[[0,1],[2,1]],[[2,2],[1,1]],[[0,1],[0,0]],[[1,1],[1,1]] ] -
>> number 1 appear 3 times on arr(x0,y1)
>
> How can I do this?
> Thanks
print,total(arr eq 1,3,/int)
where "1" is the number you are looking for and "3" the dimension you
are looking at.
|
|
|