I want to save the vectors "c" and "r" for each iteration in the loop(code below). Any suggestions please?
lines = houghlines(rotI,theta,rho,P,'FillGap',5,'MinLength',25);
for k = 1:length(lines)
xy = [lines(k).point1; lines(k).point2];
a = (xy-1);
r = (xy+1);
c = [a(1) a(2) r(2) r(1)];
r = [a(3) a(4) r(4) r(3)];
end
The two vectors "c" and "r" are both 1x4 in the first iteration. When I tried using "c(k),r(k)" it returns the error: "In an assignment A(I) = B, the number of elements in B and I must be the same". And when I used "c(k,:),r(k,:)", it gave me the error message: "Subscripted assignment dimension mismatch". The thing is "c" and "r" will increase in size at each loop iteration; and want it to be such that when k=1: c&r = 1x4 k=2: c&r = 2x4....k=n: c&r = nx4 How do I save c & r? Please help.