How to make an app that does not loose data when it's closed?
Show older comments
I have an app kind of a calculator. It stores data in a UITable with a special property that increases with each pressing on the button to store the data in the app. UITable and its variable are reset when the app restarted. Is there a way to prevent the them to get reset and continue from the previous work?
Accepted Answer
More Answers (1)
Angelo Yeo
on 24 Nov 2023
I understand you do not want to overwrite previous files and want to make new name everytime. I suggest you save data with time marker of present time. For example,
filename = "myfile_"+string(datetime('now', 'format', 'yyyyMMddHHmmss'))+".mat";
save(filename, 'mydata')
When you come back, you can use the latest data among the "mat" based on the filenames.
3 Comments
piston_pim_offset
on 24 Nov 2023
piston_pim_offset
on 24 Nov 2023
Edited: piston_pim_offset
on 24 Nov 2023
Angelo Yeo
on 24 Nov 2023
If you only specify the filename, all variables in base workspace will be saved as "mat".
Categories
Find more on Spreadsheets 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!