stats sum

sub


The sub function subtracts a numeric value from a CImage object or 1-dimensional array.

Whereas this function operates on a pure (indexed) array, the slightly slower subn function operates on a general table that may be a multi-dimensional array or contain a mixture of numbers, strings, named keys, and sub-tables.

Syntax

result = sub( object, value )

bullet.gif    where object is a 1-dimensional array, CImage object, or simple number.

bullet.gif    value is a number.

bullet.gif    result is returned as an array, CImage object, or number, depending on the type of value.

Examples

The following script subtracts 3200.5 from all members of a table.

t = sub( tbl, 3200.5 )

-- subtract the number from all members of the table

  

The next script subtracts 3200.5 from all pixels of a CImage.

V = AttachView( "CImageView" )

-- attach the topmost image window

Assert( V and V:Count() > 0 )

-- make sure an image window is on top

sub( V:GetImage(), 3200.5 )

-- subtract the number from the CImage

Related Topics

Table and Array Functions

CImage Class

 


Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.