nancumprod: Cumulative product of a matrix, with user-specified treatment of NaNs.
Computes the cumulative product of matrix A along dimension DIM, allowing the user to replace NaNs with ones, or to maintain NaNs as placeholders.
USAGE: B = nancumprod(A, DIM, NMODE)
A: Input matrix.
B: Output cumulative product matrix, treating NaNs as determined by nmode.
DIM: B = nancumprod(A, DIM) returns the nan-cumulative product of the elements along the dimension of A specified by scalar DIM. For example, nancumprod(A,1) works down the columns, nancumprod(A,2) works across the rows. If DIM is not specified, it defaults to the first non-singleton dimension of A.
NMODE: specifies how NaNs should be treated. Acceptable values are:
1: REPLACE NaNs with ones (default).
2: MAINTAIN NaNs as position holders in B. (Skip NaNs without reset.)
3: RESET product to 1 on NaNs, replacing NaNs with ones.
4: RESET product to 1 on NaNs, maintaining NaNs as position holders.
See also: cumprod, nancumprod, nansum, nanmean, nanmedian, ...
(nancumsum is available from the FEX; other nan* functions may require Toolboxes)
Brett Shoelson (2022). nancumprod (https://www.mathworks.com/matlabcentral/fileexchange/14927-nancumprod), MATLAB Central File Exchange. 取得済み .
プラットフォームの互換性Windows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!