How to SAVE data to disk in a background thread?
8 ビュー (過去 30 日間)
古いコメントを表示
Has anyone figured out a way to run the SAVE command in a background 'thread', so that MATLAB can keep on running code while the file is getting written to the disk?
0 件のコメント
採用された回答
Jan
2013 年 1 月 13 日
You can call a MEX-function, which opens a new thread, and the main thread returns to Matlab. The thread running in the background is not allowed to call any Matlab functions, so anything starting with "mx..." and "mex..." must be avoided. When you want to write a binary file, fwrite is fine.
You have to be sure, that the data are not changed during writing. E.g. a pointer to the data of a Matlab array might lead to inconsistencies, when the data are modified or free'd during the writing. But this concerns all multi-threading applications, such that I assume, that you have solved this already.
3 件のコメント
Jan
2013 年 1 月 14 日
I cannot imagine that this could be faster than doing this in a single-threaded application. You can create a standalone application, which is able to save MAT files. Perhaps you can forward the values using http://www.mathworks.com/matlabcentral/fileexchange/28572-sharedmatrix.
その他の回答 (1 件)
Image Analyst
2013 年 1 月 14 日
I don't have it, but doesn't the Parallel Computing Toolbox have that capability?
参考
カテゴリ
Help Center および File Exchange で MATLAB Compiler についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!