Most Efficient Spreadsheet File

8 visualizzazioni (ultimi 30 giorni)
Daniel
Daniel il 19 Nov 2014
Commentato: Daniel il 20 Nov 2014
Hello,
I am going to write a Matlab script that will pull data from multiple Excel files. I imagine this script will take a long time to run. I was wondering if I could save my Excel files as a different file type to make the script work more efficiently. I will only be using one spreadsheet from each excel file and I am only going to be reading text from the Excel files.
Thanks.
  3 Commenti
Image Analyst
Image Analyst il 19 Nov 2014
Tell us how many files you will read. Is it more than about 5 or 10 or so?
Daniel
Daniel il 20 Nov 2014
I am going to be reading 20-30 files. Each file will have roughly 2000 rows and 5 columns of data. Only one column of the data will be numeric, the other columns will be names, serial numbers, and comments.

Accedi per commentare.

Risposte (2)

Image Analyst
Image Analyst il 19 Nov 2014
It will take a long time, unless you use ActiveX. See my attached ActiveX demo. With ActiveX it only opens and shutdowns Excel once instead of every single time you call xlsread().
  3 Commenti
Image Analyst
Image Analyst il 20 Nov 2014
For that amount of data, you certainly don't want to use xlsread(). You could use ActiveX, but if you can, I think the fastest way would be to convert the data to text (like a csv file) and use csvread(), dlmread(), or importdata(). ActiveX would be more complicated and probably not faster than these text-reading functions since ActiveX still has to launch Excel.
Daniel
Daniel il 20 Nov 2014
I can't use csvread or dlmread because those are for numeric data only. I made a CSV file and tested the import speed using both importdata and textscan with a simple MATLAB script. Each time I imported the data, textscan was about 10-30 times faster than importdata.

Accedi per commentare.


Evan
Evan il 19 Nov 2014
If Image Analyst's solution doesn't work for you, you might try csvread. Assuming you're able to save your data in .csv format, I've found that csvread is a couple orders of magnitude faster than xlsread.

Community Treasure Hunt

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

Start Hunting!

Translated by