MATLAB: Append data to the end of a txt file…works for 1 line…it doesnt work for two lines

append datatxt

the above append alength to the end of 111.txt
clc
fid = fopen('C:\Users\Mr Andrew\Desktop\111.txt', 'a');
for k = 1:5
fprintf(fid,'alength \r\n')
end
fclose(fid);
but if i try this
clc
fid = fopen('C:\Users\Mr Andrew\Desktop\111.vbs', 'a');
for k = 1:5
fprintf(fid,'alength
blength \r\n')
end
fclose(fid);
it doesnt work…what i am doing wrong? thank you…

Best Answer

fprintf(fid,'alength\r\n blength\r\n') ;