hey everyone
please i am getting this error :
Improper assignment with rectangular empty matrix on this line :
midpoints1(k) = (leftEdge1 + rightEdge1)/2;
how can i solve that ? any help is appreciated, thanks
for k=700:800 oneRow1 = binaryImage(k, :); leftEdge1 = find(oneRow1, 1, 'first'); rightEdge1 = find(oneRow1, 1, 'last'); hold on; midpoints1(k) = (leftEdge1 + rightEdge1)/2; plot(leftEdge1, k, 'rx','LineWidth',2); plot(rightEdge1, k, 'rx','LineWidth',2); plot(midpoints1(k), k, 'yx','LineWidth',2);endX1=(700:800);midpoints1=midpoints1(midpoints1~=0);new_x1 = linspace(500, 900);coeffs1 = polyfit(X1, midpoints1, 1);new_y1 = polyval(coeffs1, new_x1);plot(new_y1,new_x1, '-','LineWidth',2);
Best Answer