- write the code as simply as possible not worrying about optimisation
- if code is too slow, run the profiler
- only then, if the profiler indicates that xlswrite is a bottleneck, replace it with something else.
Most Efficient Spreadsheet File
조회 수: 8 (최근 30일)
이전 댓글 표시
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
Image Analyst
2014년 11월 19일
Tell us how many files you will read. Is it more than about 5 or 10 or so?
답변 (2개)
Image Analyst
2014년 11월 19일
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
Image Analyst
2014년 11월 20일
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.
Evan
2014년 11월 19일
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!