MATLAB: Adding data to existing excel

addingdataexcel

Hi, I want to ask a question I want a program where I can add more row data every time I execute this program, but when i execute this code, only row 2 got added, not 3, 4, etc. I want it to stack, every time I run the program
here is the code :
tgl=4;
Jumlah=1;
nama='adawd';
ntgl=3;
nJumlah=3;
nnama='dddd';
A = {'Tanggal','Jumlah Laki-Laki','Nama Video'; tgl,Jumlah,nama};
baru = {ntgl,nJumlah,nnama};
A(end+1,:) = baru;
xlswrite('Masukkan nama file.xls',A);

Best Answer

You need to use the xlsread() first to determine what the last row of your existing data it. Then use xlswrite's 3rd and 4th arguments to make sure you're writing additional data to the end of the existing data.