getomlvar
Imports the OML variable value to the Python variable
Syntax
status = getomlvar(OMLVariableName,PythonVariableName)
Inputs
- OMLVariableName
- OML variable name.
- PythonVariableName
- Python variable name.
Outputs
- status
- Status of the script executed.
- 1
- success
- “error message”
- failure
Examples
EvalOmlScript('opfalse = false;')
status = getomlvar('opfalse','pyfalse')
print(status)
1
EvalOmlScript('opint = 999;')
status = getomlvar('opint','pyint')
print(status)
1
EvalOmlScript('opfloat = 999.999;')
status = getomlvar('opfloat','pyfloat')
print(status)
1
EvalOmlScript('opcomp= 99+99i;')
status = getomlvar('opcomp','pycomp')
print(status)
1
EvalOmlScript("opstring='String Data';")
status = getomlvar('opstring','pystring')
print(status)
1
EvalOmlScript("opcell = {'aa','bb','cc','dd'};")
status = getomlvar('opcell','pylist')
print(status)
1
EvalOmlScript("opstruct = struct('key1',123, 'key2','test');")
status = getomlvar('opstruct','pydict')
print(status)
1
EvalOmlScript("opmatrix = [1 2 -3;4 5 6;-7 8 0];")
status = getomlvar('opmatrix', 'pymatrix')
print(status)
1
EvalOmlScript("opndmatrix = [1,2,3;4,5,6];")
EvalOmlScript("opndmatrix(:,:,2) = [7,8,9;10,11,12];")
status = getomlvar('opndmatrix','pyndmatrix')
print(status)
1
EvalOmlScript("row = [1, 2, 4, 4, 1, 5, 2, 3, 4, 1, 2, 3, 4, 1, 4];")
EvalOmlScript("col = [1, 1, 1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6];")
EvalOmlScript("vals = [10, 20, 40, -90, 110, 150, 170, 180, 190, 210, -220, 230, 240, 260, 290];")
EvalOmlScript("s = sparse(row, col, vals);")
status = getomlvar('s','s')
print(status)
1
Comments
OML Variable Type | Python Variable Type | Limitations |
---|---|---|
Logical | Bool | |
Number | Float | |
Complex | Complex | |
String | String | |
Cell (1,n) n:number of elements in list | List | Cell with one dimension only supported. |
Struct | dict | Struct with one dimension only supported. |
Matrix | Numpy - Matrix | Data types supported in OML include: matrix, Bool, Int, long, Float, Complex. |
ND Matrix | Numpy Ndarray | Data types supported in OML include: matrix, Bool, Int, long, Float, Complex. |
Sparse matrix | Scipy - CSC (Compressed Sparse Column Matrix) |