MATLAB: How to store all the values of for loop in a single variable

loop

clc
clear all
for i=17.890:+0.005:17.920
a=i
end
I am getting different values of a after running the program, but I want an array

Best Answer

In your case its simply a=i but you have asked it for clarifcation so the illustration is as follows:
i=17.890:0.005:17.920;
a=zeros(size(i)); % preallocate
for k=1:numel(i)
a(k)=i(k); % index with loop iterator (k)
end
a