Igo*_*nko 14 wolfram-mathematica
我想知道Mathematica中是否存在使用大文件的方法?目前我有一个大约500Mb的文件与表数据.
Import["data.txt","Table"];
Run Code Online (Sandbox Code Playgroud)
什么是替代方式?
Tim*_*imo 13
使用OpenRead["file"]它可以为您提供InputStream可以使用的对象Read[stream].根据数据文件的格式,你可能需要设置自定义的选项值Read[]了RecordSeparators.
例:
In[1]:= str = OpenRead["ExampleData/USConstitution.txt"]
Out[1]= InputStream["ExampleData/USConstitution.txt", 24]
In[2]:= Read[str, Word]
Out[2]= "We"
In[3]:= Read[str, Word]
Out[3]= "the"
In[4]:= Read[str, Record]
Out[4]= "People of the United States, in Order to form a more perfect Union,"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7337 次 |
| 最近记录: |