## MATLAB: I face the error of “In an assignment A(I) = B, the number of elements in B and I must be the same” when i want to create a loop a matrix. the simple short code given below, plz help me

for loopmatrix

clc clear x1=5; x2=3; x3=2; for i=1:3 if i==1 x1=6; elseif i==2 x1=7; elseif i==3 x1=8; end p(i)=[x1-x2 x3-x2; x2-x3 x1-x3] end

## Best Answer