Main Content

gmultiply

Generalized multiplication

Syntax

gmultiply(a,b)

Description

gmultiply(a,b) takes two matrices or cell arrays, and multiplies them in an element-wise manner.

Examples

Multiply Matrix and Cell Array Values

This example shows how to multiply matrix and cell array values.

gmultiply([1 2 3; 4 5 6],[10;20])
ans = 2×3

    10    20    30
    80   100   120

gmultiply({1 2; 3 4},{1 3; 5 2})
ans=2×2 cell array
    {[ 1]}    {[6]}
    {[15]}    {[8]}

gmultiply({1 2 3 4},{10;20;30})
ans=3×4 cell array
    {[10]}    {[20]}    {[30]}    {[ 40]}
    {[20]}    {[40]}    {[60]}    {[ 80]}
    {[30]}    {[60]}    {[90]}    {[120]}

Version History

Introduced in R2010b