Create large complex matfile

1 回表示 (過去 30 日間)
Johannes
Johannes 2012 年 12 月 7 日
Hello,
how can you create a large complex array in a matfile without allocating memory for the whole array?
The following works perfectly well for real data:
matObj = matfile(filename, 'Writable', true);
matObj.data(rows,cols,channels,channels) = 0;
I tried changing it to:
matObj = matfile(filename, 'Writable', true);
matObj.data(rows,cols,channels,channels) = 1i;
which raises the following error:
The class and attributes of the right hand side could
not be converted into the type of the variable in the
file.
Thank you in advance!

採用された回答

Walter Roberson
Walter Roberson 2012 年 12 月 7 日
編集済み: Walter Roberson 2012 年 12 月 7 日
Just make sure that the first thing written is complex.
If the array is not already complex in the file, you will probably need to rewrite it all.
Note: if you need a complex value that happens to be (0,0) then use
complex(0,0)
  1 件のコメント
Johannes
Johannes 2012 年 12 月 7 日
Thanks! The problem was that the file actually already existed on disk with the variable being real.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by