Is there a way to recognize blank lines when you are scanning a text file in Matlab? I want to parse the files based on the blank lines in between the text. Is this possible?
Yes, it's possible. A MATLAB snippet would look something like:
fid = fopen('reader.m');
newline = sprintf('\r\n');
line = fgets(fid);
while ischar(line)
if strcmp(newline, line)
disp('Empty line');
else
disp('Non-empty line');
end
line = fgets(fid);
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With