相当于Matlab textscan的Python [英] Python equivalent of Matlab textscan

查看:151
本文介绍了相当于Matlab textscan的Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一些Matlab代码传输到Python.我是Python的新手,不确定与Matlab的 textscan 方法.任何帮助将不胜感激.

I'm working with transferring some Matlab code to Python. I'm relatively new to Python and am unsure of a Python equivalent of Matlab's textscan method. Any help would be greatly appreciated.

推荐答案

如果要将Matlab转换为Python,我假设您已经在使用NumPy.

If you're translating Matlab to Python, I'll assume you're already using NumPy.

在这种情况下,您可以使用 np.loadtxt (如果没有缺少任何值)或

In that case, you can use np.loadtxt (if no values are missing) or np.genfromtxt (if there are missing values: I'm not sure whether Matlab's textscan handles that).

如果需要更多帮助,请给我们更多详细信息!

Give us a few more details if you need more help!

这篇关于相当于Matlab textscan的Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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