Read or Write an Excel file in Matlab.
1 view (last 30 days)
Show older comments
I used a lot of read and write functions in Matlab, xlsread and xlswrite. However when I run it pops up a lot of windows that:
Microsofe Excel has stopped working, and Windows is checking for a solution.
Why it is idle? Thanks.
6 Comments
dpb
on 24 Jul 2013
I used them in a loop, each time write a value into an Excel file but different cell in excel. Like:(note location cell will not change for different i)
For i=1:N
xlswrite('Validation.xlsx', {value{1}(m)},'Interface Inputs','I22');
xlswrite('Validation.xlsx', {value{1}(m)},'Interface Inputs','I23');
end
I don't follow--you say a different cell then expressly note that cell location will not change??? Why write the same thing multiple times?
I suspect your loop in Matlab is trying to execute faster than the COM engine can keep up and you're thus "locking up" Excel.
I don't use Excel but as a toy and have never done the link w/ Matlab other than just as an exercise here or at cs-sm for a particular syntax problem or the like so I'm sorta' guessing but--
1) Can you not write an area/block at a time rather than a single cell, and
2) I suggest use the return values from xlswrite() and inspect status and particularly the status message if indicates a failure.
3) If you think you must use the kind of structure you're using, try inserting a short pause in the loop and see if that solves the problem.
Answers (0)
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!