fileID = fopen('A.txt','w'); fprintf(fileID,'%15s %15s %15s\r\n','x','y','z'); nbytes = fprintf(fileID,'%15d %15d %15d\n',A) fclose(fileID);