newmatic

버전 0.2.2 (210 KB) 작성자: Keith Ma
Create new MAT-files optimized for partial reading and writing of large arrays
다운로드 수: 38
업데이트 날짜: 2021/11/8

See the demo at: http://www.allnans.com/newmatic/newmatic_demo.html

About
--------

This tool solves a few problems I ran into when using "matfile" to manage partial IO, namely:

+ *Inability to control data chunking*: Arrays in MAT-files are saved in "chunks". The most natural and performant way to read/write to these arrays is to access one chunk at a time. MATLAB chooses the chunk size automatically and it may (read: almost certainly) not be the most efficient choice for your workload. The recommended solution is to use third-party tools to
"repack" your MAT-file after you create it (see section "Accelerate Save and Load Operations for Version 7.3 MAT-Files" at https://www.mathworks.com/help/matlab/import_export/mat-file-versions.html). This should make us all sad.

+ *Repetitive and cryptic array size initialization (see: https://www.mathworks.com/help/matlab/import_export/troubleshooting-file-size-increases-unexpectdly-when-growing-an-array.html) Assigning a value to the very last element in the array serves a similar purpose as pre-allocating arrays for in-memory variables. The recommended approach is fine, but not easy for the uninitiated to parse and ugly to look at.

Fortunately, (a) MAT-files are HDF5 formatted under the hood, and (b) MATLAB includes utilities for working with HDF5 files directly (i.e., without any external tools). newmatic provides an alternative interface for creating "customized" MAT-files that perform well for partial IO.

Additional notes:

+ newmatic only allocates arrays. If you want to include other data types (strings, cell arrays, whatever), you can add them to the file created by newmatic in the usual way.

+ This initial version of newmatic depends on the system CLI h5repack (see: https://support.hdfgroup.org/HDF5/doc/RM/Tools.html#Tools-Repack), a future update will drop this dependency in favor of the native MATLAB hdf5 interface.

Example Usage
---------------------

There are two key functions in this package:

+ newmatic_variable is used to define the name, data type, array size, and chunk size for variables created by newmatic

+ newmatic creates a MAT-file with the specified variables

Here is a small example demonstrating how to create a MAT-file with two arrays (created by newmatic) and a cell array (not created by newmatic).

mat = newmatic(...
'my-mat-file.mat', ...
newmatic_variable('x', 'double', [1000, 1000, 20], [1000, 1000, 1]), ...
newmatic_variable('y', 'double', [1000, 10, 10], [5000, 10, 10]));
mat.z = {'a', 'cell', 'array'};

인용 양식

Keith Ma (2024). newmatic (https://github.com/keithfma/newmatic), GitHub. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2019b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기
태그 태그 추가

Community Treasure Hunt

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

Start Hunting!

GitHub 디폴트 브랜치를 사용하는 버전은 다운로드할 수 없음

버전 게시됨 릴리스 정보
0.2.2

Improve compatibility in demo script

0.2.1

Logical variables are read as correct datatype

0.2.0

Drop h5repack dependency in favor of MATLAB's native HDF5 utilities. This change also yields a bug performance improvement for large files (a critical use case).

0.1.1

Improved FEX description

0.1.0

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.