Displaying 1 result from an estimated 1 matches for "_a_procedure_is_wanted".
2003 Aug 25
1
floodfill with matrix data
...-----------------
The problem:
## (1) Given the following matrix
z <- matrix(c(0,0,0,0,0,0,
0,1,1,1,1,0,
0,1,0,0,1,0,
0,1,1,1,1,0,
0,1,0,0,1,0,
0,1,0,1,1,0,
0,0,0,0,0,0), nrow=6, ncol=7)
image(z)
## (2) _a_procedure_is_wanted to
# "floodfill" all zeroes with 2 "outside 1"
# to give
## (3) the following result:
z <- matrix(c(2,2,2,2,2,2,
2,1,1,1,1,2,
2,1,0,0,1,2,
2,1,1,1,1,2,
2,1,2,2,1,2,
2,1,2,1,1,2,
2,2,2,...