Impixel doesn't work the second time.
CENTER = 0;[X,Y,MAX]=getcenter(MA,x,y)if (MAX > CENTER) [X,Y,MAX] = getcenter(MAX,X,Y); CENTER = MAX; endfunction [X,Y,MAX] = getcenter(MA,X,Y)value = impixel(MA,X,Y); % FAILS HERE WHEN getcenter is called the second time.
for i = -5:5 for j = -5:5 temp = impixel(MA, X + i,Y + j); if temp > value value = temp; X = X + i; Y = Y + j; end end end MAX = value;
The function getcenter fails the second time around at impixel. Error using interp2>makegriddedinterp (line 237) Interpolation requires at least two sample points in each dimension. Consider using INTERP1 if X or Y have constant coordinates that can be eliminated to reduce the dimension.
Error in interp2 (line 128) F = makegriddedinterp({X, Y}, V, method,extrap);Error in impixel (line 106) rgb = interp2(xx,yy,a,xi,yi,'*nearest');Error in getcenter (line 2)value = impixel(MA,X,Y);Error in MAflow (line 17) [X,Y,MAX] = getcenter(MAX,X,Y);
ideas? thanks
Best Answer