This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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 = 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]}

Introduced in R2010b