\name{Match} \alias{Match} %- Also NEED an '\alias' for EACH other topic documented here. \title{Value Matching} \description{ 'Match' returns a vector of the positions of (first) matches of its first argument in its second. Second must be an element of class segSet (or a numeric matrix with 2 columns) ordered and without overlapping segments (function or.segSet is designed for this purpose). } \usage{ Match(x, a) } \arguments{ \item{x}{a vector of positions} \item{a}{an element of class segSet} } \value{ a vector of same size a x. Values are indices corresponding to element 'a', 0 when no segment found. } \note{This can be used for a texture, when we know only regions, described by set of segments.} \author{Antoine Lucas} \examples{ a = matrix(c(1,30,40,50,60,70,80,110),ncol=2,byrow=TRUE) a = or.segSet(a) ## show a: a Match(1:40,a) ## texture sample: b = matrix(c(15,18, 28,45, 1,10, 15,20, 25,40, 17,23, 35,38,100,105, 110,120),ncol=2,byrow=TRUE) b = or.segSet(b) texture = ( Match(1:120,a)>0 ) + ( Match(1:120,b)>0 )*2 ## change numbers to colors texture <- as.factor(texture) levels(texture) <- c("red","blue","green","yellow") texture <- as.character(texture) plot(1:120,rep(1,120),col=as.character(texture)) } \keyword{utilities}