How write multiple data output in excel sheet

3 次查看(过去 30 天)
Hi All I want to get data from a serial port and stored in Excel sheet and i repeated this several times. but Every time a new value replaces in the previous value. but i need all the data. How do I store this data in a different sheet or file(Dynamic File Name). Regards

采纳的回答

Image Analyst
Image Analyst 2013-2-26
Have you looked up xlswrite() and seen how the arguments let you specify the sheet or the cell to write to?
  2 个评论
mohammad tahmasebi
mohammad tahmasebi 2013-2-26
Yes, I know,I want to run this Program for Several times but Problem is when it comes to xlswrite , it always writes from the A1 cell thus the values will be overwritten and output will be only the last array containing new value. i want to keep the old values and want to write a new value in new raw , file or sheet each time.
Image Analyst
Image Analyst 2013-2-26
That tells me that you have not read the documentation, which says:
xlswrite(filename,A,sheet,xlRange) writes to the specified sheet and range, xlRange.
See the third argument, sheet? That is the name of the sheet. You could use 'This sheet' or 'That sheet' or 'Results' or 'Data' or whatever you want.
See the third argument, range? If you specify 'D42', it will put the upper left part of your array at cell D42, not A1.
If you don't specify the sheet, and don't use ActiveX, then it will blow away all prior contents on the first sheet. So if you want to keep those, then you need to use xlsread() to read in the current contents, and add your new data to that cell array, or else specify a different sheet.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by