fn_bin

Contents

Syntax

data = fn_bin(data,bins(vector)|xybin(scalar)[,'same'][,'sum|mode'][,'mask',mask][,'and|or')
[data maskbin] = fn_bin(data,xybin(scalar)[,'mask',mask])

Description

bin data according to vector describing which binning to apply for each
dimension
for example, can be used to bin 3D data image (x,y,t) in space and time
Input:
- data    array of size s
- bins    vector of length up to ndims(data); use negative values to
          specify desired output sizes rather than bin sizes
- flags:
  'same'      make binned data same size as original
  'sum'       sum over each block rather than averaging
  'mode'      take most frequent value inside block rather than averaging
  'min|max'   take min or max over each bin
  'and|or'    performs a logical 'and' or 'or' rather than averaging;
              note that if data is a logical, 'and' is chosen by default
  'smart'     cover all the data; for this all blocks do not have exactly the
              same number of elements
  'mask',mask the first dimension in data corresponds to pixels
              inside the provided mask: a new binned mask is computed, and
              first dimension in the output data corresponds to pixels in
              this new mask
See also fn_enlarge

Source

Thomas Deneux

Copyright 2010-2017