Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Mata matrix to Stata matrix form

From   Ian Watson <>
To   statalist <>
Subject   st: Mata matrix to Stata matrix form
Date   Thu, 6 Oct 2005 12:11:22 +1000


  Does anyone know how can I get mata matrix in stata
  matrix. I give one example here.

  A = st_matrix("iotaN1")
  B = st_matrix("iotaN2")
  C = st_matrix("iotaN3")
  D = blockdiag(A, blockdiag(B,C))
  When I try "mat dir", I don't see matrix D.
  I want to get back the matrix D on stata to make my
  matrix calculation, but I do not know how to make it.

You need to use the command

mata describe

from the mata : prompt to see what matrices mata has created. And you
can return matrices from mata to Stata using:


which you can then see from within Stata (after using -end- to quit
mata) with

mat dir

which should show not only your iotaN1 iotaN2 iotaN3, but also newmat.

There is a good summary of this on page 503 of the Mata manual (on
st_global, Remarks).

Kind regards, 

Ian Watson
Senior Researcher
acirrt, University of Sydney
NSW, 2006, Australia

phone: 02 9351 5622

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index