R rounds. Perhaps Matlab avoids doing so here. It's hard to say because your code is too long for anyone to read through. Maybe you could post a smaller reproducible example to pinpoint the result you see here. If you can do that, I think you may also find that the R-help mailing list is a better fit for your question. See a description of the mailing lists here: http://www.r-project.org/mail.html -- View this message in context: http://r.789695.n4.nabble.com/Matlab-Program-to-R-tp4706207p4706801.html Sent from the R devel mailing list archive at Nabble.com.