-------------------
This is an extension of factorial.m in Matlab R13, for matrices. It is inspired by a post on CSSM.
-------------------
F = FACTORIALM(M) returns the factorial for all integers of the matrix M.
So,F(i) is the product of all integers from 1 to M(i), i.e. prod(1:M(i)).
F has the same size as M. NaNs and Infs in M will yield NaNs in F.
Example:
factorialm([1 6 0 ; NaN 4 -Inf])
will return : 1 720 1
NaN 24 NaN
Created for MatLab 13.
Last update: jan 23, 2007
Cite As
Jos (10584) (2026). FACTORIALM (https://www.mathworks.com/matlabcentral/fileexchange/13746-factorialm), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
