function printFormat6(x,y,z) % -- File output: optional use of tabs to separate columns fprintf('\nWrite data to a file, no screen output:\n'); fout = fopen('someData.txt','wt'); fprintf(fout,'j\tx(j)\ty(j)\tz(j)\n'); for j=1:length(x) fprintf(fout,'%d\t%e\t%e\t%e\n',j,x(j),y(j),z(j)); end fclose(fout); % always close the open file handle