Use python(cPickle, Sympy, Aesara) in matlab and simulink.
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Call Python from MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
