Use python(cPickle, Sympy, Aesara) in matlab and simulink.
Show older comments
Hi,
I wan to use serizalized funcion in matlab and simulink.
Minimum viable code like this
test.py
from six.moves import cPickle
# SymPy -> Aesara translater, bundled with SymPy.
from sympy.printing.aesaracode import aesara_function
# Arbitrary SymPy expression.
from sympy import sin
from sympy.abc import x
expr = sin(x)/x
# GPU-parallelized Aesara function compiled from that expression! Yup.
f = aesara_function([x], [expr])
g = open('obj.save', 'wb')
cPickle.dump(f, g, protocol=cPickle.HIGHEST_PROTOCOL)
g.close()
script.m
pyrun('test.py')
error message is
"Warning: Unable to load Python object. Saving (serializing) Python objects into a MAT-file is not supported.
Error using <string>><module> (line 1)
Python Error: NameError: name 'test3' is not defined"
+Dependancy: python3.10, matlab 2024a
Accepted Answer
More Answers (0)
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!