Why is xlsread so slow
Anybody can help? Thanks a lot! I am also thinking of doing the whole thing incrementally, ie. Even if I record down the previous content area, it still doesnot work. Any thoughts? All the contents of the each sheet will be appended to the end of the variable 'input'. This might not be what you are looking for, but just something you should be aware of.
Of course I create the object once and used xlsread1 , but the xlsread1 is called thousands of times I haven't used xlsread1 but I've used xlswrite1 and I can switch sheets and throw in an array of numbers quickly. I can create 3 workbooks, each with as many as 10 sheets, and hundreds of numbers in each sheet in just about seconds or so. Tens of hours seems way out of line.
Does it even complete if you wait that long? In other words, if you gave it 24 hours and came back the next day, is it done successfully? The workbooks aren't on a network are they? They're on your local hard drive, right? I know xlsread is naturally slow, but does anyone know how I can make my script run faster? The script is below, thanks!! Don't use xlsread if you want to go through a loop.
And also take a look at readtable which works faster than xlsread , but generates a table instead. The most obvious improvement seems to be to load the files only partially if possible. However, if that is not an option, try whether it helps to only open each file once read everything you need, and then assign it. Also check how much you are reading in each time, if you read in many rows in the first file, you may make the first dimension of A big, and then you will fill it each time you read a file?
As an extra: a small but simple improvment can be found at the start. Don't use 4 load statements, but use 1 and then assign variables based on the result. This was not the case in previous releases. Maybe this is what is slowing it down somehow? Yes, MSoffice is installed. Yes, file is on a local disk. Not sure how to answer "which machine"? A high-end laptop running Windows 10?
Really I'm just curious is something was changed internal to the xlsread function that may have caused this, and if there are any plans to improve it in the future? The public forum has no knowledge about what MathWorks plans to modify in the future. Did you contact them already directly? If the relative time of import and computing has changed, maybe Rb computes much faster, while xlsread stayed at the same speed. Please clarify te details. Run some tests with importing the files under te different releases.
An impression about the "relative speeds" of processing a data import does not allow to draw unique clues aboud the absolute times.
Answers 3. Guillaume on 15 Jan I'm just curious is something was changed internal to the xlsread function. It's not something that can be answered by us. We're generally not told about what goes on internally at Mathworks and even if we were it would most likely be covered by a non-disclosure agreement.
As Jan said, for this sort of questions you're better off asking Mathworks support directly. I note that you use the 'basic' mode of xlsread. This mode uses an internal parser developed by mathworks I assume , it does not rely at all on Excel to obtain the data so whether MSoffice is installed doesn't actually matter. It's very much possible that Mathworks have made some change to that parser probably to make it more reliable which maybe would make it slower particularly as it looks like it will become the default mode for readtable in a future release.
See the release notes about functionality change of UseExcel. But again, that's all conjecture, contact Mathworks to know for sure. Jeremy Hughes on 15 Jan
0コメント