How to load portions of .dat file
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello everyone,
I'm trying to load a large .dat file. It is made by a 3x15000000 matrix. So I want to load only a portion of it time, like 3x30000 at one time, analyze that portion and then load another 3x30000 portion. Can someone help me? Thank you
6 Kommentare
Antworten (1)
Jan
am 5 Okt. 2022
[fid, msg] = fopen(FileName, 'r', 'b');
assert(fid > 0, msg);
while true
data = fread(fid, [3, 30000], 'uint32');
if numel(data) < 3*30000
break;
end
... process the block of data here
end
7 Kommentare
Walter Roberson
am 6 Okt. 2022
65175552/4/3
so your file has room for about 18 times as much data as would be needed for [3, 30000], and the data = fread(fid, [3, 30000], 'uint32'); should have succeeded unless you had already read a portion of the file (or had used fseek to get to near the end.)
Siehe auch
Kategorien
Mehr zu Low-Level File I/O finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!