Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Extract matrix size and store in a macro

    Hello Statalisters,

    Is there a command to extract the dimensions of a matrix, something like this :

    local n_col=colnumb(my_mat)
    display `n_col'

    I've tried the help and internet, but did not find anything satisfying.

    Thank you for your help

  • #2
    This was asked here on 5 September: http://www.statalist.org/forums/foru...ns-of-a-matrix

    help matrix leads to help matrix functions

    If combining functions was what you missed, then consider

    Code:
     
    . matrix A = J(1,2,42) 
    
    . local dim (`= rowsof(A)',`=colsof(A)') 
    
    . di "`dim'" 
    (1,2)

    Comment


    • #3
      I missed it . Thanks a lot

      Comment

      Working...
      X