6

I know spio.loadmat does not properly load symbolic variables created in Matlab into Python. But, I am wondering if anyone here has ever tried to load such .mat files in Python using any sort of trick.

hpaulj
  • 221,503
  • 14
  • 230
  • 353
Saj_Eda
  • 203
  • 1
  • 10
  • Such a load would require recreating in sympy variables and expressions that mimic the MATLAB ones. Do you have any idea how similar they are? Maybe you need to give a MATLAB sample, and the sympy equivalent. – hpaulj Jun 08 '18 at 01:45
  • I personally have no idea how these modules interact with computer. But, it seems to me Matlab does a more rigorous definition for symbols far different from its numeric variables: doubles, chars, ... whereas in Python a symbol looks like a label attached to numeric variable. That's probably why defining a symbol in Matlab take more process time. – Saj_Eda Jun 08 '18 at 15:05
  • MATLAB `syms` is similar in purpose to `sympy` `symbols()`. – hpaulj Jun 08 '18 at 16:13
  • The thing with scipy's `savemat` and `loadmat` is that they're designed for `.mat` files produced by old MATLAB versions (see note at the end of [this](https://docs.scipy.org/doc/scipy/reference/generated/scipy.io.loadmat.html) doc page). Nowadays it's probably better to read `.mat` files using an HDF5 tool like `h5py`. – Dev-iL Oct 08 '18 at 13:56

0 Answers0