MATLAB: Effective way to extract rows (range) from a text file

data importMATLABtextscan

I made a small loop to extract rows [range 183:262326] to make a column of 262144×1 column vector. The loop is very inefficient and takes a lot of time to execute. The code is below. Is there any more efficient way ? I dont want to use "Import Data" feature in MATLAB, I want to use code only.
fid=fopen('ABC.txt');
j=1;
for i=183:262326
linenum = i;
C(j,1) = textscan(fid,'%f',1,'delimiter','\n', 'headerlines',i-1);
j = j+1;
end

Best Answer

Unfortunately, due to very large size of "ABC.txt" file, it could not be uploaded. However following the hints of both the commentors. I simply used readmatrix() to extract all the numeric data. The extraction is much efficient.
A = readmatrix('ABC.txt')