一批空格分隔的文本转成 xlsx

【问题】

I am trying to read data from text file (which is output given by Tesseract OCR) and save the same in excel file. The problem i am facing here is the text files are in space separated format, and there are multiple files. Now i need to read all the files and save the same in excel sheet. I am using MATLAB to import and export data. I even thought of using python to convert the files into CSV format so that i can easily import the same in MATLAB and simply excelwrite the same. But no good solution. Any guidance would be of great help.

thank you

【回答】

这个问题用SPL处理要比MATLAB简单些:

A
1=directory@p("D:\\files\\*.txt")
2=A1.(file(~).import(;," "))
3=A2.(file("D:\\" /#/   ".xlsx").xlsexport (~))

A1:列出目录D:\\files\\下的所有文本文件。

A2:读取这些文本文件的内容。

A3:将文本文件内容分别写到xlsx。

也可以指定不同目录下的文件,或以同名文件输出到xls,可命令行调用或集成使用。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值