create()
Creates a multi-dimensional data variable
Syntax
y = create(Dimensionality, DependDataType, IndepName, IndepType, NumRows, NumColumns)
Arguments
| Name | Description | Range | Type | Default | Required |
|---|---|---|---|---|---|
| Dimensionality | dimensionality of the data variable or array | [1, ∞) | integer | yes | |
| DependDataType | Dependent data type | † | string | "Real" | no |
| IndepName | Name(s) of independent | string | "__i" | no | |
| IndepType | Independent data type | † | string | "Real" | no |
| NumRows | Number of rows | [0, ∞) | integer | 0 | no |
| NumColumns | Number of columns | [0, ∞) | integer | 0 | no |
| † "Boolean", "Integer", "Real", "Complex", "String" or "Byte16" | |||||
Examples
result = create(1, "Complex", {"Index"}, {"Real"},1, 1);
returns a 1 dimensional data variable with dependent type Complex, independent name "Index" and type real with 1 row and column
The array or data variable created above can be used as follows:
indepV = indep(result,"Index");
result[0] = 1.1;
indepV[0] = 1.0;
An example that modifies the input argument and returns the modified result as a data-variable is given below:
- Copy the code below into the file user_defined_fun.ael in the directory $HOME/hpeesof/expressions/ael .
defun datavar_test_create(arg1) { //Create a 1D data-var //create(dimension, DependentDataType, IndepName, IndepType, # rows, #columns) decl result = create(1, "Real", {"Index"}, {"Real"},1, 1); //Do some simple data manipulation to the input data result = conj(arg1); //Set the independent value decl idenpRV = indep(result, "Index"); idenpRV = indep(arg1); return result; } - Launch Advanced Design System. In a Data Display window, create an equation:
cre2D = datavar_test_create(S11) {{}} - Display the equation cre2D to view the contents.
A 2-dimensional example is given in the Measurement Expression AEL function below.
defun datavar_test_create2()
code}{
decl result = create(2, "Complex", {"Index1", "Index2"}, {"String", "Real"},1,1);
decl idenp1V = indep(result, "Index1");
decl idenp2V = indep(result, "Index2");
decl iD1, iD2;
for (iD1=0; iD1 < 2; iD1++) {
for (iD2=0; iD2 < 3; iD2++) {
result[iD1,iD2] = complex(iD1, iD2);
idenp2V[iD2] = iD2;
} //for
idenp1V[iD1] = strcat("Val", iD1);
} //for
return result;
}
The following example creates an arbitrarily sized 1-dimensional array with one or more independent variables in an AEL expression. It returns a one dimensional array with 100 values (0-99) having the independent variable called time (0-99 usec).
defun create_one_dim()
{{{}}
decl i;
{{ decl NrPoints=100;}}
{{ decl X = create(1, "Real",Unknown macro: {"time"},Unknown macro: {"Real"},1, 1); // Create the array}}
{{ decl indep_X = indep(X,"time"); // Get the Independent variable (time)}}
{{ for(i=0; i<NrPoints; i++)}}
{{ {}}
{{ indep_Xi=i/1E6; // Set the time value}}
{{ Xi=i; // Set the result value}}
{{ }}}
{{ return X;}}
}
The following example creates an arbitrarily sized 2-dimensional array vs FileName and Frequency (3 Filenames and 100 frequencies for each filename).
This function returns a two dimensional array vs. FileName and Frequency.
defun create_two_dim()
{{{}}
{{ decl i, j;}}
{{ decl NrFiles=3;}}
{{ decl NrFreqs=100;}}
{{ decl result = create(2, "Real",Unknown macro: {"FileName", "freq"},Unknown macro: {"String","Real"},1, 1); }}
{{ decl indep_file = indep(result,"FileName"); // Get the first independent variable (Filename)}}
{{ decl indep_freq = indep(result,"freq"); // Get the second independent variable (freq)}}
{{ for(i=0; i<NrFiles; i++)}}
{{ {}}
{{ decl FN=strcat("File_",i); // Create a filename string}}
{{ indep_filei=FN; // Set the Filename to the string}}
{{ for(j=0; j<NrFreqs; j++)}}
{{ {}}
{{ indep_freqj=j*1E6; // Set the frequency value}}
{{ resulti,j=j*i; // Set the result value}}
{{ }}}
{{ }}}
{{ return result;}}
}
Defined in
Built in
See Also
Notes/Equations
The create() function can only be used from the measurement expression AEL code and not from the DDS, the schematic, or PDE AEL.
See the Examples section.
This function is used to create multi-dimensional data variable or arrays. Data Variables in ADS/RFDE are data structures that are used to hold multi-dimensional data. Internally they are not implemented as arrays, and therefore do not have the performance of an array. Accessing and setting data in these arrays are performance intensive and should be noted.
The number of rows and columns are used in specifying the dimension of matrix data. For a scalar this would be 1, 1.
Privacy
Statement
|
Terms of Use
|
Legal |
Contact Us
|
© Agilent 2000-2008 ![]()