I have a data matrix data = m x n, which I want to transform into a single column vector data(:), and write this vector to an output file.
data = ;
for idx_row = 1:100
A = fscanf(fileID,formatSpec);
data = cat(1,data, A);
data = int16(data);
fp = fopen([filepath 'data.dat'], 'wb');
The problem is that the size of data is very large to fit in the memory (e.g. 100 x 1e10). And, each row of the data is saved in separate file, and I must read them separately.
I can read a single row, which works file, but when I try to add more rows, the computer runs out of memory rather quickly. :(
Also, when creating a large array to fill the data in runs into the same problem regarding out of memory -
Error using nan
Requested 100x10000000000 (7450.6GB) array exceeds maximum array size preference. Creation of arrays greater
than this limit may take a long time and cause MATLAB to become unresponsive.
How can I make it work? Thanks in advance!