in reply to Manipulating columns of PDL data using slice() method
minimum() and maximum() take the minimum and maximum values over the first dimension. As you need the these values from the second dimension, you can use xchg to swap dimensions.minimum($dataA->xchg(0,1)); maximum($dataB->xchg(0,1));
See also: http://pdl.sourceforge.net/PDLdocs/Ufunc.html#minimum
Your original code should also work, if you use double quotes instead of single ones:
-L.for(my $k=0; $k<$maxColumns; $k++) { print "Min: " . min($dataA->slice("$k,:")) . "\n\n"; print "Max: " . max($dataB->slice("$k,:")) . "\n\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Manipulating columns of PDL data using slice() method
by Anonymous Monk on Jul 03, 2007 at 20:00 UTC | |
by etj (Priest) on Jun 19, 2022 at 20:12 UTC |