Numpy等效于MATLAB的单元格数组 [英] Numpy equivalent of MATLAB's cell array

查看:71
本文介绍了Numpy等效于MATLAB的单元格数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Numpy中创建类似MATLAB的单元格数组.我该怎么做?

解决方案

Matlab单元格数组 解决方案

Matlab cell arrays are most similar to Python lists, since they can hold any object - but scipy.io.loadmat imports them as numpy object arrays - which is an array with dtype=object.

To be honest though you are just as well off using Python lists - if you are holding general objects you will loose almost all of the advantages of numpy arrays (which are designed to hold a sequence of values which each take the same amount of memory).

这篇关于Numpy等效于MATLAB的单元格数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆