Python to MATLAB: exporting list of strings using scipy.io
Posted
by user292461
on Stack Overflow
See other posts from Stack Overflow
or by user292461
Published on 2010-03-12T15:57:26Z
Indexed on
2010/03/12
16:47 UTC
Read the original article
Hit count: 523
I am trying to export a list of text strings from Python to MATLAB using scipy.io. I would like to use scipy.io because my desired .mat file should include both numerical matrices (which I learned to do here) and text cell arrays.
I tried:
import scipy.io
my_list = ['abc', 'def', 'ghi']
scipy.io.savemat('test.mat', mdict={'my_list': my_list)
In MATLAB, I load test.mat and get a character array:
my_list =
adg
beh
cfi
How do I make scipy.io export a list into a MATLAB cell array?
© Stack Overflow or respective owner