% script to read an N x 2 table from a data file % and plot it % open the data file to read - r for read, t for text fid = fopen('exp.txt','rt'); % formatted scanf - "vectorized"... don't need loop structure! % [2, inf] describes the dimension of A [A] = fscanf(fid, '%f', [2, inf]) %close the file fclose(fid); % do the plotting disp('Press Enter to see the plot') pause plot(A(1,:), A(2,:))