Announcement

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

  • Get max value in all matrix

    Hi all,

    I wonder if its possible get the max value in all a matrix,

    I can order a matrix but only for a determined columns, in this example i can order the first column:

    HTML Code:
    sysuse auto, clear
    asdoc tab rep78 foreign, matcell (x)
    matrix list x
    mata : st_matrix("x", sort(st_matrix("x") ,-1 ))
    matrix list x
    
    x[5,2]
        c1  c2
    r1  27   3
    r2   9   9
    r3   8   0
    r4   2   0
    r5   2   9
    But I would like sort all the matrix without set the column.

    Thanks in advance

  • #2
    Code:
    mata:
    a = (1, 2, 6 \ 4, 10, 0)
    a
    max(a)
    end
    ?

    Comment


    • #3
      Thanks!

      So easy and simple!

      Comment

      Working...
      X