Help for this page

Select Code to Download


  1. or download this
    # Set up initial 4x4 matrix with some arbitrary data
    pdl> p $b = pdl (10..25)->reshape(4,4);
    ...
    pdl> p $b->indexND($pos + $xfrm, 'truncate');
    [20 17 0 25]
    # $b->range($pos + $xfrm, 1, 'truncate') gives similar results
    
  2. or download this
    pdl> p $indicies = $b->indexND($pos + $xfrm, 'truncate')->which($b % 2
    +);
    # Returns: empty
    #
    ...
    #  [3 3]   # 25
    # ]
    # N.b. [2 2] would be omitted (value = 20, even), as would [4 2] (inde
    +x out of bounds)