function cubeavg

Does an average of all images in X. Optionally, a rejection value can be given which will not be used in the averaging process.

Syntax
result = cubeavg(X [, reject])

Arguments
X:   A matrix or a FITS file name. If a FITS file name is given, only one image is read into memory at a time thus saving memory.
reject:   Optional, the value to disregard


Notes
If reject is given and no pixel along the cube is different from reject, a value of 0 will be inserted.