exporttooml

Exports the Python variable value to the OML variable.

Syntax

status = exporttooml(PythonVariableName,OMLVariableName)

Inputs

PythonVariableName
Python variable name.
Type: string
OMLVariableName
OML variable name.
Type: string

Outputs

status
Status of the script executed.
1
success
“error message”
failure
Type: int | string

Examples

Export logical data to OML:
pofalse = False
status = exporttooml('pofalse', 'omlfalse')
print(status)
1
Export integer data to OML:
point = 999
status = exporttooml('point','omlint')
print(status)
1
Export precision data to OML:
pofloat=9.99
status = exporttooml('pofloat','omlfloat')
print(status)
1
Export complex data to OML:
pocomp=9+9j
status = exporttooml('pocomp','omlcomp')
print(status)
1
Export string data to OML:
postring="String Data"
status = exporttooml('postring','omlstring')
print(status)
1
Export list data to OML:
polist  = ["a","b","c","d"]
status = exporttooml('polist','omlcell')
print(status)
1
Export dictionary data to OML:
polist  = ["a","b","c","d"]
podict = {"key1":1,"key2" : polist }
status = exporttooml('podict','omlstruct')
print(status)
1
Export matrix data to OML:
import numpy as np
pomatrix = np.matrix("1 2; 3 4")
status = exporttooml('pomatrix','omlmatrix')
print(status)
1
Export an nd matrix data to OML:
import numpy as np
pondarray = np.arange(720).reshape(6,4,2,3,5)
status = exporttooml('pondarray','omlndmatrix')
print(status)
1
Export Scipy CSC sparse matrix data to OML.
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
Export Scipy non-CSC sparse matrix data to OML.
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

Any error reported is returned as a string. Returns 1 on success.
Table 1. Data Type Mapping
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