Skip to content

Commit e848cbb

Browse files
committed
Update sub2coord.m
mustBeInRange throws an error when r,c contain NaNs. Fixed by excluding NaNs in call to function.
1 parent eaa41c1 commit e848cbb

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

toolbox/@GRIDobj/sub2coord.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@
3535
error('TopoToolbox:wronginput','r and c must have the same number of elements')
3636
end
3737

38-
mustBeInRange(r,1-.6,nrows(DEM)+.6)
39-
mustBeInRange(c,1-.6,ncols(DEM)+.6)
38+
ix = not(isnan(r));
39+
mustBeInRange(r(ix),1-.6,nrows(DEM)+.6)
40+
mustBeInRange(c(ix),1-.6,ncols(DEM)+.6)
4041

4142
r = r(:);
4243
c = c(:);

0 commit comments

Comments
 (0)