Error using horzcat in code trying to get rid of discontinuities
Show older comments
Hi everyone!
When i run this code
(it reads an image rotates it then gets 100 profiles of the same length from the image and then tries to eliminate the discontinuities in the profiles)
img101 = imread('c1=100.800.1.0.1.png');
img_rot= imrotate(img101,32.06);
for i=1:100
prof_img_rot(1:256,i)=img_rot(212+i,400:655)';
end
x_0 = [1 800];
y_0 = [1 501.06];
y = improfile(img101,x_0,y_0)
yOrig = y;
limit = 0.2;
dy = [0, diff(y)];
jump = strfind(abs(dy) > limit, [false, true, false]);
for ijump = 1:numel(jump)
k = jump(ijump);
y(k+1:end) = y(k+1:end) - dy(k+1);
end
figure
axes('NextPlot', 'add')
plot(x, yOrig, '-r', x, y, 'bo')
y2 = lowpass(y, 30, 200);
plot(x, y2, 'c+')
i get the next error:
Error using horzcat
Dimensions of arrays being concatenated are not consistent.
Error in lowpass_discontinuities_simple (line 34)
dy = [0, diff(y)];
Does anyone know why?
I have attached the image im reading
Accepted Answer
More Answers (0)
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!