MATLAB: Xlsread create a copy of Excel spreadsheet

xlsread

hi everyone. Xlsread create a copy of a spreadsheet's content into Matlab, or it is just a reading of the file? I have many information into a spreadsheet, and i don't want to do access to the file every time because it could slow the execution.

Best Answer

if you have excel installed and do not call xlsread in basic mode, xlsread starts Excel (but keep the window invisible), instruct excel to load the file, and then ask excel for a copy of the data in the range you've requested. Finally, it closes the file and quit excel.
It does this every time, so multiple calls to xlsread can be slow. According to the release notes, R2015b supposedly improves the performance of multiple code, but the documentation actually does not say anything about it, so it's unclear how it is improved. A quick reading of the code would indicate it still does the whole start/load/read/unload/quit on every call.
It would be much better to read all the content that you need at once and slice it into variables afterward.
Note that if you don't have excel or call xlsread in basic mode, then matlab attempts to parse the file directly.