Actually this works
object Matrixmul extends App { val a = Array(Array(1, 2, 3), Array(4, 5, 6), Array(7, 8, 9)) val b = Array(Array(1, 2, 3), Array(4, 5, 6), Array(7, 8, 9)) val c = Array.ofDim[Int](3, 3) val sum =Array.ofDim[Int](3,3) println(a.mkString(" ")) val elements = for { row <- a ele <- row }yield ele for(array1 <-elements) println(" the 1st matrix array elements are : " + array1) This prints the arrray in the format,
the 1st matrix array elements are : 1 the 1st matrix array elements are : 2 the 1st matrix array elements are : 3 the 1st matrix array elements are : 4 the 1st matrix array elements are : 5 the 1st matrix array elements are : 6 the 1st matrix array elements are : 7 the 1st matrix array elements are : 8 the 1st matrix array elements are : 9 But I need in DIMENSION format,
1 2 3 4 5 6 7 8 9