Readtable in 2017 is taking too long

6 visualizaciones (últimos 30 días)
Benjamin Karlsen
Benjamin Karlsen el 30 de Jun. de 2020
Comentada: Benjamin Karlsen el 1 de Jul. de 2020
Hi,
I am working on a GUI for my work where it reads specific sheets of xlsm spreadsheets and continues to work on that data in table format. The size of the spread sheet is in the current case 1648 x 164 with most data being doubles, some strings and dates as well. I was given a trial version of matlab 2020 to test a toolbox and here readtable did a quite satisfying job reading the spreadsheets. However, the trial version is over and my job is not doing any version update any time soon.
That leads us to the problem. Readtable on 2017 which I am using now spends between 10 and 20 minuts reading the same spreadsheets. That is including using the detectImportOptions, which is is a bit slower than the following readtable. A work around which I have implemented is to save the tables as .mat and then read those files, however I still would like to read new sheets without growing old as well. For some reason, when I add 'basic', true to the readtable I get a message that the file does not exist as a spreadsheet, so that does not work to reduce time.
I find this a bit strange, because another work around is to use uiimport and importselected, which reads the same sheet in seconds. Similarily importdata works very quickly, however these methods require more workaround to get the data in the desired structure which is given from excel.
What is the reason for readtable being so slow? Is there a way to get the 'basic' to work as it should? Seems to me that the best way to solve this is to just use some other quicker datareading and restructure the data to desired table afterwards, however I was hoping I wouldn't have to go there.
Thanks in advance,
Benjamin
  2 comentarios
dpb
dpb el 30 de Jun. de 2020
I'd guess if you're running same code on the two versions and can actually by profiling prove the bottleneck is readtable that your only real recourse is probably the two you've outlined above--of which only one appears feasible (unless the company wants the app badly enough to do the upgrade).
If you'd attach sample spreadsheet, I do have R2017b also installed here as well as R2019b and could do a comparison between those two releases--I don't have R2020 up, though.
I "know nuthink!" really about the basic mode...
I do see something I'd never noticed before in the Tips seection --
  • Large files in XLSX format sometimes load slowly. For better import and export performance, Microsoft recommends that you use the XLSB format.
Benjamin Karlsen
Benjamin Karlsen el 1 de Jul. de 2020
Thank you for the responce, dbp.
Yes I am checking purely the readtable and detectImportOptions (have added a waitbar and tic toc so can clearly see the difference).
I can't really attach the spreadsheet, because the data it contains is confidential. I guess I could make one with fake numbers, but it seems like I just have to either go for a work around, or talk to the guys who make the sheet if they can make it a bit more matlab-friendly to solve this one.
I tried the XLSB and the loading time was about the same order.
Cheers,
Benjamin

Iniciar sesión para comentar.

Respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by