[height width]=size(r);
[height2 width2] = size(t);
sum = 0;
sum2 = 0;
for i=1:height2
for j=1:height
for k=1:width2
sum = sum + (abs(t(i,k)-r(j,k)));
end
local_dist(i,j) = sum;
sum = 0;
end
end
[height3 width3] = size(local_dist);
accum_dist(1,1) = local_dist(1,1);
for x = 2:width3
accum_dist(1,x) = accum_dist(1,x-1)+local_dist(1,x);
end
for y = 2:height3
accum_dist(y,1) = accum_dist(y-1,1)+local_dist(y,1);
end
for a = 2:height3
for b = 2:width3
accum_dist(a,b) = local_dist(a,b) + min([accum_dist(a-1,b) accum_dist(a,b-1) accum_dist(a-1,b-1)]);
end
end
distance = accum_dist(height3, width3);
I'm a little lazy and don't want to run your code, but with an error message I am more inclined to at least try to help.
-Nathan
Roger Stafford
Roger Stafford
Hm. I guess google group's "new" view doesn't work correctly with TMW newsgroup?
The post that I was responding to, which you also happened to respond to, resides here: https://groups.google.com/d/topic/comp.soft-sys.matlab/svRCviX2nX0/discussion
I KNOW not to start new threads when responding to a prior thread. I've been posting here for two years (not entirely consistently, however). (I hope this response doesn't post a new thread, but if it does, I am sorry. I am using google groups and something must have changed.)
-Nathan
Yes, on the Matlab Newsreader, the two threads appeared separately at numbers 309700 and 309706. This thread I am replying to now is also separate at number 309795. Yet the Google thread at:
contains the contents of both 309700 and 309706, so something is haywire somewhere between Google Groups and Matlab Newsreader.
Roger Stafford