MATLAB: 1×10 matrix using a single while loop

homeworkmatrix

n = 10;
A =zeros(1,n);
count=1;
while i==1 && j==1:n;
count=count+1;
A(i,j)=count;
end
display(A)
trying to get this to display A=[1 2 3 4 5 6 7 8 9 10] using exactly 1 while loop.

Best Answer

n=10;A =zeros(1,n);k=1;
while k <=n
A(k)=k
k=k+1;
end