MATLAB: How to read consecutive values of a text file into matlab and the begina for loop where MATLAB takes each value and increments it by one.

for loopincrement

Hi there,
I am trying to take values for a text file called A_Strain, read them into matlab, where they should enter into a for loop that will take the value in the text file (e) and plus 1 to it to find prinicple strain.
i.e. A foor loop that takes the values in the text files consecutively and completes the calculation,
lambda = e + 1, where e is the strain value found in the text file.
Below is the code I have tried so far. I know that the first strain value in the text file is 0.017. Therefore, the first value displayed by matlab should be 1.017.
However, from the attached code the result I am getting from MATLAB is,
"principle strain is = 2"
Any help would be much appreciated. Thanks!
filename = 'A_Strain.txt';
form = '%f';
delimiterIn = ' ';
headerlinesIn = 1;
A = importdata(filename,delimiterIn,headerlinesIn);
for i=length(A)
x = i+1;
form = '%f';
disp('The principle strain is');disp(x(i));
end

Best Answer

for i=1:numel(A)
x = A(i)+1;
fprintf('The principle strain is %f\n', x);
end