How to log(append) the data to excel sheet continously when using 'while' loop?

17 visualizzazioni (ultimi 30 giorni)
Hello! I am using MATLAB to read a real-time serial data. I am using a 'while' loop to iterate the loop continuously. Within the while loop I have a resultant matrix which stores the variables i require. Then I use 'xlswrite' command to store these values. But the problem is, for every iteration this file 'sampletest.xlsx' gets rewritten. I want the new values of every iteration to be stored in the same file i.e. they have to get appended below the previous set of values. How can I achieve this? Hoping to find some help.
while <condition>
.
.
.
filename = 'sampletest.xlsx';
D = [(vfl) (vfr) (vrl) (vrr) (temp) (tps) (delta) (time) (vv) (Ax) (s_rr) (s_rl)] %concatenated matrix
sheet = 1;
log_data = xlswrite(filename,D,sheet);
.
.
end

Risposte (1)

Walter Roberson
Walter Roberson il 6 Apr 2018

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by