Вот одна из возможностей:
fid = fopen('myfile.txt');
lines = textscan(fid, '%s', 'Delimiter', '\n');
fclose(fid);
lines = lines{1};
% lines now contains a cell array of strings,
% one per line in the file.
% Find all the blank lines using cellfun:
blank_lines = find(cellfun('isempty', lines));