/
Read from start/end of text file

Read from start/end of text file

I had a 300+GB text file; here is how to read the first and last parts:

fn = 'C:\Users\Paul\AppData\Local\2BrightSparks\SyncBackPro\CLOUD_Debug_Google drive data backup - T drive (Study Data, Collaborations).txt';
id = fopen(fn, 'r');
str0 = fread(id,500,'char');   % first 500 characters
fseek(id,-1000,'eof')   % last 1000 characters
str1 = fread(id,1000,'char');
fclose(id)

char(str0)'
char(str1)'

Related content

Raw data
More like this
T1 Files and fields
T1 Files and fields
More like this
SPM - test slice vs volume
SPM - test slice vs volume
More like this
Siemens Physiology - - UCLPrisma 3T A Human Brain Mapping
Siemens Physiology - - UCLPrisma 3T A Human Brain Mapping
More like this
Database Structure (Partial)
Database Structure (Partial)
More like this
json reading and writing in MATLAB
json reading and writing in MATLAB
More like this