MATLAB: How to write to a text file without overwriting existing file content in matlab

fprintfprintxlswrite

Matrix a in each run will be created new values and I want to save output values in each run to the same file without overwriting existing file.

Best Answer

a=rand(4)
b=[1 2 3;4 5 6]
dlmwrite('file.txt',a)
dlmwrite('file.txt',b,'-append')