I want to write daily datum into xls file without overwriting
2 次查看(过去 30 天)
显示 更早的评论
Hi All, I have a daily results of some events, which I update them every day and save the previous values as well. Here, I don't want to overwrite the previous values and add the every new date's datas at the end of previous day with their hour and the date of the day. How can I do it in a universal way, so only one run will be enough to store every days data accordingly?
row_headerSecond = {'01.00', '02.00', '03.00', '04.00', '05.00', '06.00', '07.00', '08.00', '09.00', '10.00',...
'11.00', '12.00', '13.00','14.00','15.00','16.00','17.00','18.00','19.00','20.00','21.00','22.00',...
'23.00'};
row_headerFirst = repelem({datestr(today)},23);
xlswrite('myfile.xlsx', data, 'Sheet1', 'C2');
xlswrite('myfile.xlsx',row_header','Sheet1','B2'); %Write row header
xlswrite('myfile.xlsx',row_header1','Sheet1','A2');
Thanks in advance
0 个评论
采纳的回答
Jan
2019-1-8
编辑:Jan
2019-1-8
To append data to an XLS and XLSX file, you have to import the existing data at first to find out, which rows is used already.
Num = xlsread('myfile.xlsx')
Len = size(Num, 1);
New = sprintf('C%d', Len + 1); % Or which range you mean
It is much easier to implement such logging in a text file. Then you can simply append new lines.
2 个评论
Jan
2019-3-21
what should i do if i have to write to the next line of a excel sheet..?
@Sajid: This is not an answer. Please post comments in the section for comments or as a new question.
My answer contains a method to define the start position as the first line under the existing data. This should solve your question already. So please post your code and explain, what is not clear yet.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!