Current location - Health Preservation Learning Network - Slimming men and women - Matlab reads the data of dat file, but the file is too large. What should I do if I want to try a small part? This file is a one-dimensional array with 8 unsigned bits.
Matlab reads the data of dat file, but the file is too large. What should I do if I want to try a small part? This file is a one-dimensional array with 8 unsigned bits.
With fseek, you can locate the location pointer of the file.

fid=fopen(' 1.dat,' r ')

fseek(fid, 10000,- 1)

For i= 10000: 15000.

values(i)=fscanf(fid,' %d %d ')

end

fclose(fid)

The key is the location of fseek, such as 10000 here. As long as the location is found, the location can be saved in the matrix.