Numpy 3d arrays to matlab
16 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a dataset made of 3d arrays in numpy. I want to use this dataset in Matlab. I can write these 3d arrays to csv but they are written as string. I know how to deserialize them in python but not in Matlab. Is there a way to do so? Maybe using csv as an intermediate is not the best choice. Is there anything better you would recommend ?
Here is the code I use in Python for deserialization :
x_array = inputs.apply(lambda x:
np.fromstring(
x.replace('\n','')
.replace('[','')
.replace(']','')
.replace(' ',' '), sep=' ')
.reshape(20,20)).apply(lambda x:
np.array([x]))
Thank you!
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!