I want to write daily datum into xls file without overwriting
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Omer Yasin Birey
el 8 de En. de 2019
Comentada: Jan
el 21 de Mzo. de 2019
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 comentarios
Respuesta aceptada
Jan
el 8 de En. de 2019
Editada: Jan
el 8 de En. de 2019
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 comentarios
Omer Yasin Birey
el 8 de En. de 2019
Editada: Omer Yasin Birey
el 8 de En. de 2019
Jan
el 21 de Mzo. de 2019
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.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!