Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: novice Mata question


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: novice Mata question
Date   Thu, 19 Apr 2007 06:27:26 -0400

Ade said
I wanted to write a function in Mata that deletes rows in a column
vector (or matrix) that contain 0.


The simplest sort of solution ( in English ) would be
matrix temp = matrix temp taking out one row

but this assignment obviously can't be done because of conformability errors.

Do I need to use pointers to do this?

Or alternatively how can I delete a matrix in Mata so that I can
create an intermediate matrix?


You mean something like

: adrian=(1,0,3,4,0,2,9,0,0,1)

: pruned = select(adrian,adrian)

: pruned
1 2 3 4 5 6
+-------------------------+
1 | 1 3 4 2 9 1 |
+-------------------------+


Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


*
* 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