Main Content

gdivide

Generalized division

Syntax

gdivide(a,b)

Description

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

Examples

Divide Matrix and Cell Array Values

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

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

    0.1000    0.2000    0.3000
    0.2000    0.2500    0.3000

gdivide({1 2; 3 4},{1 3; 5 2})
ans=2×2 cell array
    {[     1]}    {[0.6667]}
    {[0.6000]}    {[     2]}

gdivide({1 2 3 4},{10;20;30})
ans=3×4 cell array
    {[0.1000]}    {[0.2000]}    {[0.3000]}    {[0.4000]}
    {[0.0500]}    {[0.1000]}    {[0.1500]}    {[0.2000]}
    {[0.0333]}    {[0.0667]}    {[0.1000]}    {[0.1333]}

Version History

Introduced in R2010b