comparison scripts/general/interp2.m @ 6979:2883ea1c5c18

[project @ 2007-10-08 20:23:48 by dbateman]
author dbateman
date Mon, 08 Oct 2007 20:26:01 +0000
parents ebf96cc00ee9
children 44b18d51d1db
comparison
equal deleted inserted replaced
6978:b75630794a11 6979:2883ea1c5c18
217 idx = sub2ind (size (Z), yidx+jj, xidx+ii); 217 idx = sub2ind (size (Z), yidx+jj, xidx+ii);
218 ZI = Z(idx); 218 ZI = Z(idx);
219 endif 219 endif
220 220
221 ## set points outside the table to 'extrapval' 221 ## set points outside the table to 'extrapval'
222 ZI (XI < X(1,1) | XI > X(1,end) | YI < Y(1,1) | YI > Y(end,1)) = extrapval; 222 if (X (1, 1) < X (1, end))
223 if (Y (1, 1) < Y (end, 1))
224 ZI (XI < X(1,1) | XI > X(1,end) | YI < Y(1,1) | YI > Y(end,1)) = ...
225 extrapval;
226 disp("1\n");
227 else
228 ZI (XI < X(1,1) | XI > X(1,end) | YI < Y(end,1) | YI > Y(1,1)) = ...
229 extrapval;
230 disp("2\n");
231 endif
232 else
233 if (Y (1, 1) < Y (end, 1))
234 ZI (XI < X(1,end) | XI > X(1,1) | YI < Y(1,1) | YI > Y(end,1)) = ...
235 extrapval;
236 disp("3\n");
237 else
238 ZI (XI < X(1,end) | XI > X(1,1) | YI < Y(end,1) | YI > Y(1,1)) = ...
239 extrapval;
240 disp("4\n");
241 endif
242 endif
243
223 ZI = reshape (ZI, shape); 244 ZI = reshape (ZI, shape);
224 else 245 else
225 246
226 ## If X and Y vectors produce a grid from them 247 ## If X and Y vectors produce a grid from them
227 if (isvector (X) && isvector (Y)) 248 if (isvector (X) && isvector (Y))