%% Product Excluding NaN
% Create a vector and compute its product, excluding NaN values. If you do not specify 'omitnan', then prod(A) returns NaN.

A = [1 3 2 4 NaN 3 NaN 2];
P = prod(A,'omitnan')

% Copyright 2012 The MathWorks, Inc.