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 <[email protected]>
To   statalist <[email protected]>
Subject   st: Mata matrix to Stata matrix form
Date   Thu, 6 Oct 2005 12:11:22 +1000

PNIR PUISSANCE <[email protected]> wrote:

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

  mata:
  A = st_matrix("iotaN1")
  B = st_matrix("iotaN2")
  C = st_matrix("iotaN3")
  D = blockdiag(A, blockdiag(B,C))
  end
  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:

st_matrix("newmat",D)

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

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

phone: 02 9351 5622
email:[email protected]
www.acirrt.com
-------------------------------

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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