% script to create a table for the function y = exp(x) % and store it in a data file % declare x and y as row vectors x = 0:.1:1; y = [x; exp(x)]; % open the data file to write - w for write, t for text fid = fopen('exp.txt','wt'); % formatted print - "vectorized"... don't need loop structure! fprintf(fid,'%6.2f %12.8f\n',y); %close the file fclose(fid);