Can multiple processes read and write a .mat file at the same time?

3 ビュー (過去 30 日間)
MP
MP 2025 年 8 月 9 日
コメント済み: Walter Roberson 2025 年 8 月 14 日
I am working with an app that attempts to do live visualization of data being generated by a Simulink script. Is it safe for the simulink app to write to the mat file (mat v7.3) while another app reads from it? I know HDF5 supports SWMR, but not sure if that capability is inherited by the mat format.
Thanks!
  1 件のコメント
Rik
Rik 2025 年 8 月 11 日
This smells like a recipe for file corruption. Did you find any documentation? And did you try to devise a test?

サインインしてコメントする。

回答 (1 件)

Ritika Thusoo
Ritika Thusoo 2025 年 8 月 14 日
Hi,
The Single-Writer/Multiple-Reader (SWMR) capability in MATLAB®'s low-level HDF5 function interface enables appending or overwriting data in datasets while multiple reader processes simultaneously access the updated data.
These reader and writer processes can operate on the same or different platforms, and the feature eliminates the need for inter-process communication or file locking.
You can read about this from this reference:
  1 件のコメント
Walter Roberson
Walter Roberson 2025 年 8 月 14 日
Note that this functionality is not necessarily enabled for -v7.3 .mat files. Such files are layered on HDF5, but do not necessarily go through the necessary configuration.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDependency Analysis についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by