1
I tried to remove some lines from a file using following commands.
fData = textread('s0001_rem.hea', '%s','delimiter','\n','whitespace', '');
fData ([20 19 18])=[];
fid=fopen('s0001_rem.hea', 'w');
for i=1:length(fData)
fprintf(fid,'%s', '\n', fData {i});
end
fid=fclose(fid);
But after running this command, I opened the file to check and it does not show newlines anymore. It shows all the information in a single line and instead of a newline, it shows \n
.
I'm new to Matlab, so I have no idea how to solve this problem.Checked everywhere on the internet but had no luck.Please help me. I'm using Matlab R2014b on MacOS.
Note
.hea file is a kind of a .txt file with some information. It exactly works like a text file.