create

From DavinciWiki
Jump to: navigation, search


64-bit SafeYes

Description

Create an array of values

Arguments and Return Values

Arguments: dimension values, organization and counting options

Return Value: A numeric array with the desired characteristics

Usage

Syntax: create(x = INT, y = INT, z = INT [, org = ORG, format = FORMAT, start = VAL, step = VAL, init = BOOL)

The create() function creates an array of data of the specified size, format and organization.

The 'x', 'y' and 'z' parameters specify the size of each axis. If a value is not given, it is assumed to be 1.

The 'org' and 'format' parameters specify the organization (one of bil, bip, bsq, xyz, xzy, zxy) and format (one of byte, short, int, float or double). The default organization is bsq. The default format is int.

The array is filled with a ramp. The first element is numbered from the 'start' parameter (default of 1) and each successive element is incremented by the step size (default of 1).

init - if init is 0 the start and step values are ignore and the array is defaulted to the random contents of the memory block that was allocated. NOTE: on Linux, this may not actually allocate all the memory upfront and a delayed failure may occur if that memory is not available at the time of use.

Examples

 dv> a=create(3,3,1)
 3x3x1 array of int, bsq format [36 bytes]
 0       1       2
 3       4       5
 6       7       8

 dv> x1=create(10,10,1,start=1,step=.05,format=float)
 10x10x1 array of float, bsq format [400 bytes]
 1.00000 1.05000 1.10000 1.15000 1.20000 1.25000 1.30000 1.35000 1.40000 1.45000
 1.50000 1.55000 1.60000 1.65000 1.70000 1.75000 1.80000 1.85000 1.90000 1.95000
 2.00000 2.05000 2.10000 2.15000 2.20000 2.25000 2.30000 2.35000 2.40000 2.45000
 2.50000 2.55000 2.60000 2.65000 2.70000 2.75000 2.80000 2.85000 2.90000 2.95000
 3.00000 3.05000 3.10000 3.15000 3.20000 3.25000 3.30000 3.35000 3.40000 3.45000
 3.50000 3.55000 3.60000 3.65000 3.70000 3.75000 3.80000 3.85000 3.90000 3.95000
 4.00000 4.05000 4.10000 4.15000 4.20000 4.25000 4.30000 4.35000 4.40000 4.45000
 4.50000 4.55000 4.60000 4.65000 4.70000 4.75000 4.80000 4.85000 4.90000 4.95000
 5.00000 5.05000 5.10000 5.15000 5.20000 5.25000 5.30000 5.35000 5.40000 5.45000
 5.50000 5.55000 5.60000 5.65000 5.70000 5.75000 5.80000 5.85000 5.90000 5.95000


DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Related Functions

Recent Core Changes

Modified On: 09-09-2011

Personal tools