exporttooml
Exports the Python variable value to the OML variable.
Syntax
status = exporttooml(PythonVariableName,OMLVariableName)
Inputs
- PythonVariableName
- Python variable name.
- OMLVariableName
- OML variable name.
Outputs
- status
- Status of the script executed.
- 1
- success
- “error message”
- failure
Examples
pofalse = False
status = exporttooml('pofalse', 'omlfalse')
print(status)
1
point = 999
status = exporttooml('point','omlint')
print(status)
1
pofloat=9.99
status = exporttooml('pofloat','omlfloat')
print(status)
1
pocomp=9+9j
status = exporttooml('pocomp','omlcomp')
print(status)
1
postring="String Data"
status = exporttooml('postring','omlstring')
print(status)
1
polist = ["a","b","c","d"]
status = exporttooml('polist','omlcell')
print(status)
1
polist = ["a","b","c","d"]
podict = {"key1":1,"key2" : polist }
status = exporttooml('podict','omlstruct')
print(status)
1
import numpy as np
pomatrix = np.matrix("1 2; 3 4")
status = exporttooml('pomatrix','omlmatrix')
print(status)
1
import numpy as np
pondarray = np.arange(720).reshape(6,4,2,3,5)
status = exporttooml('pondarray','omlndmatrix')
print(status)
1
import numpy as np;
from scipy.sparse import csc_matrix
row = np.array([0, 2, 2, 0, 1, 2])
col = np.array([0, 0, 1, 2, 2, 2])
data = np.array([1, 2, 3, 4, 5, 6])
csc = csc_matrix((data, (row, col)), shape=(3, 3))
status=exporttooml('csc','csc')
print(status)
1
import numpy as np;
from scipy.sparse import csr_matrix
row = np.array([0, 2, 2, 0, 1, 2])
col = np.array([0, 0, 1, 2, 2, 2])
data = np.array([1, 2, 3, 4, 5, 6])
csr = csr_matrix((data, (row, col)), shape=(3, 3))
csc = csr.tocsc()
status=exporttooml('csc','csc')
print(status)
1
Comments
Python Variable Type | OML Variable Type | Limitations |
---|---|---|
Bool | Logical | |
long, Float | Number | |
Complex | Complex | |
List | Cell (1,n) n:number of elements in list | Does not support if the list contains Dict (with limitation), Tupple, Set. |
dict | Struct | Supports only if keys in dict are string or char. |
Numpy - array, matrix | Matrix | Data types supported in OML include: matrix, Bool, Int, long, Float, Complex. |
Numpy Ndarray | ND Matrix | Data types supported in OML include: matrix, Bool, Int, long, Float, Complex. |
Scipy - CSC (Compressed Sparse Column matrix) | Sparse Matrix |