making a big dat(binary) file

2 ビュー (過去 30 日間)
PEDRO FELICIANO
PEDRO FELICIANO 2020 年 4 月 12 日
コメント済み: PEDRO FELICIANO 2020 年 4 月 14 日
Hello people, I need to make a single binary file containing several sessions of electrophysiological recordings. The dat file needs to be a matrix where every single row is a single channel and columns represent samples. My old Matlab code did the dat file by creating a matrix(ch x samp) first, writing down the matrix into the dat file, cleaning up memory and starting with the next session. It works well but, somedays I have sessions where the data matrix is bigger than the memory capacity of my machine. Making Matlab running out of memory.
Been able to write down channel by channel into the dat file I think it could work. Did someone know if that is possible? Inserting a row by row into the dat file using a loop?
It is my understanding that fwrite writes in column order. Is it possible to have a code that writes in row order?
Thanks,
  2 件のコメント
dpb
dpb 2020 年 4 月 12 日
編集済み: dpb 2020 年 4 月 12 日
Just transpose array x on output --
fwrite(fid,x.')
But will still have groups of data of Nsamp x Mchan in each block in the file.
Probably simplest is to modify the file structure slightly to write the block size each time first.
If you have existing files, add a version ID as the first value in the file that you can scan and test for...then your code can handle either version.
PEDRO FELICIANO
PEDRO FELICIANO 2020 年 4 月 14 日
I'll try that. Thanks.

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

回答 (1 件)

Rajani Mishra
Rajani Mishra 2020 年 4 月 14 日
As mentioned in previous comment you can take transpose of array x and thus column by column data can be written.
  1 件のコメント
PEDRO FELICIANO
PEDRO FELICIANO 2020 年 4 月 14 日
I'll try that, thanks.

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

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by