Hi
I am stumped by the problems I face with simple conditionals in using
the which() function. I have tried many different ways in trying to
solve it but none of them give me the result I want.
Here is a sample:
use PDL;
# a random list of values that are above and below 0
my $a = randsym(100) - 0.5;
# create a lag of 1
my $idx = xvals($a->dims) - 1;
$i = $i->setbadif($i < 0)->setbadtoval(0); # can this be more elegant ?
# find all the positions where $a[i] > 0 and $a[i - 1] < 0
# in essence where $a crosses the zero line
my $b = zeroes($a->dims);
my $b_idx = which($a > 0 && $a->index($i) < 0);
# set those points as 1
$b->index($b_idx) .= 1;
Everytime I run this I get "multielement piddle in conditional
expression" errors.
I have not been able to find an elegant solution to this problem. I
cannot seem to create a mask that has more than 1 piddle comparisons.
Please help.
Thanks
Vikas
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl