Argh. I should have read your whole post before hitting "Send". Sorry.
whichND returns true values in a mask PDL. So you can use the form I gave or
"$location = ($a>30)->whichND()" or "$location = whichND($a>30)". If you ask
for "$a->whichND($a>30)", that is the same as "whichND($a,$a>30)", and the
second argument gets more-or-less ignored.
If you want separate
On Aug 4, 2012, at 12:48 PM, Craig DeForest wrote:
> Use whichND.
>
> $location = whichND $a>30;
>
> On Aug 4, 2012, at 11:07 AM, Tim Haines wrote:
>
>> Hi, all.
>>
>> I am trying to find the 2D coordinates of particular values in a piddle. I
>> came up with the following, but is there an easier (better?) way? I was
>> thinking that whichND would do this directly without the call to ndcoords,
>> but it always returns *all* of the coordinates- not just the ones that match
>> the mask.
>>
>> use PDL;
>> $a = sequence(10,5);
>> $b = $a->ndcoords->mv(0,2)->whereND($a>30);
>> print $a, join(',', $b->dims()), "\n", $b;
>>
>>
>> Many thanks.
>>
>> - Tim
>> _______________________________________________
>> Perldl mailing list
>> [email protected]
>> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl