Is there a way to generate a matrix where each element is defined as 10 + row_index + column_index without loops?
I am trying to create a matrix where each element is defined as 10 * row_index + column_index. Rows and columns can be resized up to a 9x9 matrix. For example:
11 12 13 14 15 16
21 22 23 24 25 26
31 32 33 34 35 36
41 42 43 44 45 46
51 52 53 54 55 56
The algorithm is extremely simple with loops for
, but I have been warned to avoid loops for
unless absolutely necessary when working with matrices because they are slower than vector / matrix operations.
What other ways to create such a matrix in Matlab 2012b?
+3
source to share