# clear everything: rm(list=ls(all=TRUE)) detach() graphics.off()
# make a test matrix: ( m<- matrix((1:12)/12, 3, 4) ) library(gplots) # display the test matrix: image(m, col=colorpanel(12, "darkblue", "yellow", "white"), axes=FALSE) # here's the action part (no index checking, lame, illustrative code only, with advance apologies, &c.): image.ij<- function(i,j) return( t(m)[dim(t(m))[1]:1,][i,j] ) # we're seeing a "1" in the top right-hand corner of the image at coordinates: i<- 1 j<- 3 image.ij(i,j) # cf. what's in the matrix at those coordinates: m[i,j] > Hello. > > > I have a matrix whit n1 rows and n2 columns called example. > If I do image(example), R shows me an image with 480x480 pixels. > > How can I obtain the gray level of the pixel of row i and column j? > > Thanks, > > Arnau. [[alternative HTML version deleted]] ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html