필터 지우기
필터 지우기

Increase execution speed of saving using matfile

조회 수: 6 (최근 30일)
Stefan
Stefan 2019년 2월 27일
답변: Jan 2019년 2월 27일
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?
TimingMatFile.PNG

채택된 답변

Jan
Jan 2019년 2월 27일
A MAT file can contain a set of variables and store the data in compressed form. Appending new data to an existing variable is expected to be slow. It would be much more efficient to use a binary file and export the data to the MAT file at the end of the process at once.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by