Documentation

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

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

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

    10    20    30
    80   100   120

gmultiply({1 2; 3 4},{1 3; 5 2})
ans = 

    [ 1]    [6]
    [15]    [8]

gmultiply({1 2 3 4},{10;20;30})
ans = 

    [10]    [20]    [30]    [ 40]
    [20]    [40]    [60]    [ 80]
    [30]    [60]    [90]    [120]

Was this topic helpful?