Main Content

gmultiply

R2026b

(To be removed) Generalized multiplication

gmultiply will be removed in a future release. For more information, see Transition Legacy Neural Network Code to dlnetwork Workflows.

For advice on updating your code, see Version History.

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 =

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

  2x2 cell array

    {[ 1]}    {[6]}
    {[15]}    {[8]}
gmultiply({1 2 3 4},{10;20;30})
ans =

  3x4 cell array

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

Version History

Introduced in R2010b

collapse all