In R, we may make a matrix-like object with row-number or column number using a base function. For example, in R:
x = diag(5) % R code
row(x) [,1] [,2] [,3] [,4] [,5][1,] 1 1 1 1 1[2,] 2 2 2 2 2[3,] 3 3 3 3 3[4,] 4 4 4 4 4[5,] 5 5 5 5 5col(x) [,1] [,2] [,3] [,4] [,5][1,] 1 2 3 4 5[2,] 1 2 3 4 5[3,] 1 2 3 4 5[4,] 1 2 3 4 5[5,] 1 2 3 4 5
Is there a similar function in Matlab that does the job similar to base R 'row' or 'col'?
Best Answer