exporttopython

Exports the OML variable value to the Python variable.

Syntax

[status,errorMessage]=exporttopython(omlVariableName, PythonVariableName)

Inputs

PythonVariableName
Python variable name.
Type: string

Outputs

omlVariableName
OML variable.
Type:
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: matrix, Bool, Int, long, Float, Complex.
ND Matrix Numpy - Ndarray Data types supported in OML: matrix, Bool, Int, long, Float, Complex.
Sparse Matrix Scipy - CSC (Compressed Sparse Column Matrix)  

Examples

Exporting logical data to Python:
opfalse = false;
[status, errormessage] = exporttopython(opfalse,'opfalse')
status = 1
errormessage =
Exporting integer data to Python:
opint = 999;
[status, errormessage]=exporttopython(opint,'opint')
status = 1
errormessage =
Exporting precision data to Python:
opfloat = 999.999;
[status, errormessage] = exporttopython(opfloat,'opfloat')
status = 1
errormessage =
Exporting complex data to Python:
opcomp= 99+99i;
[status, errormessage]=exporttopython(opcomp,'opcomp')
status = 1
errormessage =
Exporting string data to Python:
postring='String Data'; 
[status, errormessage]=exporttopython(postring,'opstring')
status = 1
errormessage =
Exporting cell data to Python:
opcell = {'aa','bb','cc','dd'};
[status, errormessage] = exporttopython(opcell,'opcell')
status = 1
errormessage =
Exporting struct data to Python:
opstruct = struct('key1',123, 'key2','test');
[status, errormessage]=exporttopython(opstruct,'opstruct')
status = 1
errormessage =
Exporting matrix data to Python:
opmatrix = [1 2 -3;4 5 6;-7 8 0];
[status, errormessage ]= exporttopython(opmatrix,'opmatrix')
status = 1
errormessage =
Exporting nd matrix data to Python:
opndmatrix = [1,2,3;4,5,6];
opndmatrix(:,:,2) = [7,8,9;10,11,12];
[status, errormessage ] = exporttopython(opndmatrix,'opndmartix')
status = 1
errormessage =
Export Sparse matrix data to Python:
row = [1, 2, 4, 4, 1, 5, 2, 3, 4, 1, 2, 3, 4, 1, 4];
col = [1, 1, 1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6];
vals = [10, 20, 40, -90, 110, 150, 170, 180, 190, 210, -220, 230, 240, 260, 290];
s = sparse(row, col, vals);
[status, errormessage ] = exporttopython(s,'s')
status = 1
errormessage =