I need to use the xlsread command (and eventually the xlswrite command) in Matlab to import/export data from/to Excel. However, I need to do this while the excel file is open. Is this possible? How to do it?
Thanks,
Alaa
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
xlsreadis does not care if the file is already open or not. Just use it with the standard calling convention.To use
xlswriteon an open file, you need to open the file in a way that allows changes. There are two ways to do this, by opening it read-only, or using the “share” feature.To use the “share” feature
First, set up your spreadsheet to allow writes from multiple simultaneous users. In Office 2007 you do this from the “review” ribbon, “share workbook”, “allow changes by more than one user at the same time …”
After performing an
xlswritefrom Matlab, you need to press save in the open file to force the changes to appear.To open the file read-only
From Excel, press the open icon, select the file, and use the “Open read only” drop down selection in the “Open” dialog box. In this case it looks like you have to re-open the file to get the new data to appear.