offset_array()

Creates a new array by copying an existing AEL array except that the lower bound of a specified dimension is modified to a given value. Since this function does not work on HPvars, ensure that the parameters passed are arrays.

See also: resize_array(), array_size(), array_type(), array_lowerBound(), array_upperBound(), convert_array().

Syntax:

new = offset_array(<arr>, <dim>, <min>)

where

arr is a valid AEL array.

dim is an integer that specifies which dimension of <arr> will have its lower bound modified in the new array.

min is an integer that specifies what the lower bound of <dim> will be in the new array.

new is a new valid AEL array.

Example:
decl i,j;
        decl a = {{1,2,3},{4,5,6}};
        fputs(stderr, identify_value(a)); // outputs {{1,2,3},{4,5,6}} 
        for (i=0;i<2;i++) // NOTE: access begins at 0
        for (j=0; j<3; j++)
        fputs(stderr,a[i,j]); // loop output is: 1 2 3 4 5 6
        decl b = resize_array(a,2,-1,3);
        fputs(stderr, identify_value(b)); 
        //outputs{{<int>,1,2,3,<int>},{<int>,4,5,6,<int>}} 
        // where <int> is uninitialized integer.
        for (i=0;i<2;i++) // NOTE: access of 2nd dim begins at -1
        for (j=-1; j<4; j++)
        fputs(stderr,b[i,j]); //loop output is:<int> 1 2 3 <int><int> 4 5 6 <int>
        decl b = offset_array(b,2,0);
        for (i=0;i<2;i++) // NOTE: access of 2nd dim now begins at 0
        for (j=0; j<5; j++)
        fputs(stderr,b[i,j]); //loop output is:<int> 1 2 3 <int><int> 4 5 6 <int>

Where Used:

Measurement Expressions (Data Display equations and Schematic MeasEqns), Schematic, Layout, Simulation, GUI

 

Privacy Statement  | Terms of Use  | Legal | Contact Us  | © Agilent 2000-2008 

Contents
Additional Resources