Increase execution speed of saving using matfile
Show older comments
I want to continously save data (in appdesigner if that is relevant), therefore I create a matfile object on startup and then append data using a timer:
"Main"
app.SavingObject = matfile(app.FileName,'Writable',true);
And in a timer:
app.SavingObject.Data(app.sizeMyVar(1)+1:app.sizeMyVar(1)+size(NewPoints,1),1:app.sizeMyVar(2)) = NewPoints;
This will append my Data in the correct way.
What bothers me, if profiling this, you will see, that 40% of the time is spent internally using "whos". Sure this can be adjusted by the amount of how much data is written per call (I write ~60k Values per call), but it somehow feels like a waste of time and the amount of data per call is kind of fixed in my setup.
Is there a way to increase the wrtiting speed?

Accepted Answer
More Answers (1)
Pritesh Parmar
on 15 Apr 2025
Edited: Pritesh Parmar
on 17 Apr 2025
0 votes
Hi Stefan,
I had the similar issue with MATLAB's "save -append" with updating variables with large dataset. Does the the following code work for you?: fastSaveUpdate - Efficiently update variables in MAT-file - File Exchange - MATLAB Central
Pritesh Parmar
Categories
Find more on Data Import and Analysis 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!