Create large complex matfile

1 Ansicht (letzte 30 Tage)
Johannes
Johannes am 7 Dez. 2012
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!

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 7 Dez. 2012
Bearbeitet: Walter Roberson am 7 Dez. 2012
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 Kommentar
Johannes
Johannes am 7 Dez. 2012
Thanks! The problem was that the file actually already existed on disk with the variable being real.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Large Files and Big Data finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by