mata
y = runiform(10, 10)
_sort((sorted = vec(y)), 1)
sorted[length(sorted)-1]
Nick
njcoxstata@gmail.com
On 11 April 2013 22:22, Wu Zhang <wuzhang50@yahoo.com> wrote:
> Hi there,
>
> Could you help me find the second largest element of a matrix? I know "max" can find the largest one, but for the second largest?
>
> Thanks,
>
> Wu
>
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/