Statalist The Stata Listserver


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

st: RE: extract selection of columns from matrix


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: RE: extract selection of columns from matrix
Date   Sun, 10 Sep 2006 21:39:17 -0500

I am not sure can do this directly in matrix commands.  However, Nick Cox's
-matselrc- will do the heavy lifting for you.  Use -findit matselrc- to
locate and download. 

(note:  -findit matrix extraction- would have pointed to this)

For example:
clear
matrix A = matuniform(10,10)
matselrc A B , r(1/3) c(1/3, 5/7)
matrix list B

Scott

> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Tom Boonen
> Sent: Sunday, September 10, 2006 7:23 PM
> To: [email protected]
> Subject: st: extract selection of columns from matrix
> 
> Hello,
> 
> I have a matrix:
> 
> matrix define A = (1,2,3,4,10,11,12,13 \ 5,6,7,8, 1,2,3,4)
> matrix list A
> 
> Now I want to extract a matrix B which should contain rows 1..3; and
> then the first, third, fifth and all columns higher than five of
> matrix A.
> 
> I tried:
> 
> matrix B = A[1..3,1.3.5...]
> 
> But it doesn't work. How can I extract a selection of colums? The
> reference manual does not contain an example on this problem. Thanks
> for your help!
> 


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