MATLAB: Write text in file

MATLAB

how i can wtite or save output "text message' in file.txt

Best Answer

txt = 'text message';
fid = fopen('file.txt', 'wt');
fprintf(fid,'%s', txt);
fclose(fid);