I'm running a program where I bring in several matrices of data from a MS Excel file using the xlsread() function. I want to make my code run faster, and the importing steps are currently consuming most of the run time of the code. Are there any ways that I can improve the speed via the following conceptual strategies:
1.) Only import the excel data once per work session, rather than every time I run the sequence of calculations.
2.) Move the Excel data to some other kind of file that Matlab can read faster, and import from that file instead of from Excel.
Here's an example of one of the code lines that I'm using that is running kinda slow:
ReacParam = xlsread('H2_O2 System3','Rxn Parameters','B2:D22');

 채택된 답변

the cyclist
the cyclist 2012년 8월 17일

0 개 추천

The slowness comes primarily from the opening and closing of the Excel file. If you are working with just one Excel file, try this entry from the FEX:
It is a modified version of xlswrite that assumes the file is open already. (It explains how to open the file for the first read.)

댓글 수: 3

Karl Broer
Karl Broer 2012년 8월 19일
Ok, thanks, I'll try this.
Suraj Srivastava
Suraj Srivastava 2015년 4월 30일
Hi,
Colud you please tell me that, How can I use xlswrite1 in GUI. I have used it, but it gives error.
Any comment is appreciated.
Thanks, Suraj
Stephen23
Stephen23 2015년 4월 30일
편집: Stephen23 2015년 4월 30일
@Suraj Srivastava: the description of xlswrite1 it gives the complete code required to use it. Have you tried this? What error messages are you getting? How are you calling it?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

질문:

2012년 8월 16일

편집:

2015년 4월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by