Excel XLSWRITE problem (help)

Hi guys , I have some variables which need to get copied in an excel sheet. The variables gets changed every time I run the GUI program. Now when I try it with the XLSWRITE it overwrites the previous value, but I need to collect all the data. How to do that? I try to search answer online but doesn't work... It will be much helpful if we are able to store the variables in a specific columns of an excel sheet. Let say for variable A ,it should be able to store it in A1, B in B1 etc... Thanks.

 Accepted Answer

Walter Roberson
Walter Roberson on 28 Feb 2018
Pass the sheet reference to xlswrite as the third parameter and pass the range as the fourth parameter.
To check: are you using Windows with excel installed? Are you writing to xls or xlsx or are you writing to csv?

3 Comments

zhixuan hong
zhixuan hong on 1 Mar 2018
Edited: zhixuan hong on 1 Mar 2018
ya , im using windows with excel installed. I tried all the format (xls,xlsx,csv). I also try another way to solve the problem . For example ,I record the data in txt form first by using dlmwrite function. Then use readtable & writetable function to convert to xls or csv form . But some mistake appear. I don't know why ...@@
Figure 1.Data in text form
Figure 2. From text form to csv form
Figure 3.From text form to xls form
How to solve the first row problem? x156_2525Fail And for the xls form ,how to separate the data into 3 columns like csv form?
When you use readtable() pass the option 'readvariablenames', false
Thank you so much ! BUT for xls or xlsx file, is it possible separate the data into 3 columns like csv form? or I can convert csv file to xls/xlsx file?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!