How can i save multiple sets on data from MATLAB App Designer to excel?

22 views (last 30 days)
So i have created a call back function for my 'save data' edit text box. So when the user presses the 'save data' button the data from the simulation is saved to an excel file and this is my code below. However if i run multiple simulations and press 'save data' the data is saved on top of the original values and so it only saves one set of data each time.
I wanted to know how to save multiple data sets one after another, underneath one another, every time the user presses 'save data'.
Thanks in advance, Grace

Accepted Answer

Ameer Hamza
Ameer Hamza on 10 May 2020
Edited: Ameer Hamza on 10 May 2020
See the 'Range' option of writetable(): You can create a property in the app to store the current row. Increment it after each callback and use it to specify the row in excel file.
For example, if the row number is 5, then you can use something like this
writetable(t, 'filename', 'Range', ['A', num2str(5)])
Ameer Hamza
Ameer Hamza on 10 May 2020
You have written
.... 'range', ['A2' num2str(.....
replace 'A2' with just 'A'.

Sign in to comment.

More Answers (1)

saleh said bouhliga
saleh said bouhliga on 10 Oct 2020
For example
filename = book1
sheet = sheet1
table name = app.t


Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by