clc clear all close all disp('ABSTRACT') disp(' Example using the while-end loop to read a file.') % INPUTS filen='C:\abc.txt' fh=fopen(filen,'r') % CODE/OUTPUTS a=' '; % to get the loop going, start a here i=0; % i will be used in making the row_sum array % using the while-loop to read the lines of the text document while ischar(a)==true a=fgets(fh) if ischar(a)==true b=sscanf(a,'%f %f') i=i+1 row_sum(i)=b(1)+b(2) end end