function demofprintf % demofprintf Examples of using the fprintf statement % --- Define data n = 5; x = linspace(-pi,pi,n); y = x/1e6; z = x*1e6; % -- Simplest print statements, no column control printFormat1(x,y,z); % -- Print with equal precision control for all float types printFormat2(x,y,z); % -- Print with column width and precision control for all float types printFormat3(x,y,z); % -- Print with column width, precision control and scientific notation printFormat4(x,y,z); % -- Final touches. Add column headers and field width for index column printFormat5(x,y,z); % -- File output: optional use of tabs to separate columns printFormat6(x,y,z);