Write data disc periodically: how to organize this?

조회 수: 1 (최근 30일)
Amy
Amy 2017년 3월 1일
편집: Amy 2017년 3월 3일
Introduction
I would like to run simulations for an unknown number of time increments until a certain condition is reached. Typically, I would have several matrices of e.g. 50.000x50 big and some matrices of e.g. 50.000x17x50. After each time increment, the results are written to these big matlab files for storage.
Question
I would like to store the matlab files in a more efficient way, write the results to disk periodically. What is the best way to organize this?
  • Should I have a 50.000*50 matrix in xxx.mat, and save to entries (3001:4000,1:50) after every 1000 increments for example?
  • Or should I save the matrix into smaller parts of 1000x50 big? If so, what kind of structure/cell/array is good to use for that? And what name giving is handy in that case?
Thank you very much in advance!
Amy

답변 (1개)

Walter Roberson
Walter Roberson 2017년 3월 1일
Perhaps you should consider using matFile
  댓글 수: 2
Amy
Amy 2017년 3월 2일
Thank you! I hadn't heard of that before. It looks promising.
Amy
Amy 2017년 3월 3일
편집: Amy 2017년 3월 3일
I implemented matfile and I run a profiling test for about 40 minutes. It seems that this method works quite slow, the way I implemented it.
In this time I ran my script for 398 increments, and after each increment I wrote data to the matfile for 80 different variables. This resulted in 47.6 MB of data.
The profiler took 424 seconds (7 minutes) for Matfile, see picture.
What can I do to make it faster? Is matfile the solution for me?
My implementation:
m=matfile('newtest1.mat','Writable',true);
m.t(10000,1)=0;
m.saveddv(10000,20)=0;
etc. for all 80 variables
And:
m.t(i,1)=t_now;
m.saveddv(i,20)=Vsave;
etc.
where i is the number of the increment.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by