added iteration parameter to mat.train