Generalized outer product
[O,O_MAT] = OUTER(FUN,VEC1,VEC2)
Generalized outer product, like calculating VEC1 * VEC2' but instead of using multiplication to combine the elements of VEC1 and VEC2, the function provided by function pointer fun is called for each pair of elements and the results are stored in the N-by-M cell matrix O. N is the length of VEC1 and M is the length of VEC2.
The function works primarily on cell arrays VEC1 and VEC2, but inputs in the form of numeric vectors/matrices are accepted too. When using numeric inputs, the function assumes the first dimension of VEC1 and VEC2 to contain the elements to combine.
FUN: operator function pointer, the function must be a binary function operating on inputs of the type contained in the cells of VEC1 and VEC2, its output type is arbitrary
VEC1: first cell array or numeric array/matrix
VEC2: second cell array or numeric array/matrix
O: resulting 2D cell array ('cell matrix')
O_MAT: cell2mat(O), NaN if impossible to cast
Cite As
icklePhil (2024). Generalized outer product (https://www.mathworks.com/matlabcentral/fileexchange/29428-generalized-outer-product), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |