为什么从Excel中删除格式会提高MATLAB readtable的速度? [英] Why does formatting removal from Excel increase speed of MATLAB readtable?

查看:353
本文介绍了为什么从Excel中删除格式会提高MATLAB readtable的速度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含约400行和10列数据的电子表格.我在MATLAB中进行了设置,以使用readtable导入此工作表(由于数据不是本地的,因此我发现这是xlsread上最简单的方法).问题是,Excel文件中的格式导致readtable函数超级慢.数字格式(小数位)和条件格式都会影响这一点.

I have a spreadsheet with about 400 rows and 10 columns of data. I have it set up in MATLAB to import this sheet using readtable (since the data is not homegenous, I've found this to be the simplest method, over xlsread). The problem is, the formatting in the Excel file is causing the readtable function to be super slow. Both the number formatting (decimal places) and the conditional formatting are affecting this.

% With formatting: 35 seconds
% Without formatting: 1 second

我希望能够将格式保留在Excel文件中以进行可视化,但是这似乎引起了问题.有什么方法可以解决此问题而不必摆脱格式吗?

I would like to be able to keep the formatting in the Excel file for visualization purposes but it seems to be causing issues. Any way to fix this without having to get rid of the formatting?

推荐答案

您可以尝试更改 'Basic'参数设置为true ="nofollow noreferrer"> readtable :

You can try changing the 'Basic' parameter to true when loading your Excel file using readtable:

dataTable = readtable('your_file.xls', 'Basic', true);

basic模式下阅读时,将禁用对交互式功能(例如公式和宏)的支持.如果您想要的只是数据而已,那么这应该可以加快速度.

When reading in basic mode, support for interactive features (such as formulas and macros) is disabled. This should give you a speed up if all you want is the data and nothing else.

这篇关于为什么从Excel中删除格式会提高MATLAB readtable的速度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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