Statalist


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

st: st_subview() in Mata


From   Nguyen Cong Minh <congminh6@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: st_subview() in Mata
Date   Sat, 11 Aug 2007 14:38:34 -0400

Hi Statalist,

I used some Mata functions, and used st_view() to get the matrix from data,
then use st_subview() to get a submatrix from that matrix.

------ Mata code -------

real matrix V, Yall, Xall
neq = st_local("neqn")
st_view(V,., tokens(varname))
st_subview(Yall,V,.,(1\neq))
st_subview(Xall,V,.,(neq+1\cols(V)))

It reported the error:
			mysub():  3250  type mismatch
                 <istmt>:     -  function returned error

I tried different ways, but not working also.
	Yall = V[|1,1 \ rows(V),neq|]
	Xall = V[|1,neq+1 \ rows(V), cols(V)|

This way also does not working

	for(i=1;i<=neq;i++) {
		Yall = Yall , V[.,i]	
	}
	for(i=neq+1;i<=nrows;i++) {
		Xall = Xall , V[.,i]	
	}


I don't know how to fix that problem. Anyone can help me out?

Thanks so much,
Minh


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index