# cell2array

## PURPOSE

Flattens a cell array of regular arrays into a regular array.

## SYNOPSIS

function Y = cell2array( X, padEl )

## DESCRIPTION

     Flattens a cell array of regular arrays into a regular array.

     Each element of X must be a regular array, and must have the same number
     of dimensions k.  Converts X to an array Y of dimension k+1 where
     Y(:,:...,:,i) is X{i} padded to be as big as the biggest element in X
     (along each dimension). Specifically, let di1..dik be the k dimensions of
     element X{i}.  Let dj=max(dij) for each j.  Then each element of X{i} is
     padded to have size [d1 ... dk], and then the elements of X are stacked
     into a vector.  Treats the cell array X as a vector (so ignores the
     layout of X).

     USAGE
      Y = cell2array( X, [padEl] )

     INPUTS
      X          - cell array of regular arrays each with dimension k
      padEl      - [0] element with which to pad

     OUTPUTS
      Y         - resulting array of dimension k+1

     EXAMPLE
      for i=1:10; X{i}=rand(30); end; Y = cell2array(X);

     See also MAT2CELL2, CELL2MAT

     Piotr's Image&Video Toolbox      Version 2.40
     Copyright 2009 Piotr Dollar.  [pdollar-at-caltech.edu]
     Please email me if you find bugs, or have suggestions or questions!
     Licensed under the Lesser GPL [see external/lgpl.txt]

## CROSS-REFERENCE INFORMATION

This function calls:

- arrayToDims Pads or crops I appropriately so that size(IC)==dims.

This function is called by:

- bbGt Bounding box (bb) annotations struct, evaluation and sampling routines.