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

Re: st: moving data to matlab...


From   Andrew Shephard <andrew_s@ifs.org.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: moving data to matlab...
Date   Fri, 04 Feb 2005 10:18:27 +0000

I have written a plugin ("matwrite") that is capable of doing exactly this. It is available on the ssc archive (type "ssc install matwrite, replace" from within stata to install).

matwrite ing[ing*] using "filename"

will export the matrix "ing" that has variables ing* as columns as a mat-file called filename. You can export multiple matrices, and can just save variables as column vectors also. See the help file for more details.

Please note that you will require Stata 8 and that because it uses a compiled plugin, it is platform dependent. If matwrite is not available for your platform, I can provide you with the source code if you are able to compile it.

Hope you find this useful,

Andrew

simone chang wrote:


Hello,

I am manipulating quite a lot of data in stata that i
then want to use in matlab to do some maximum
likelihood estimation and non-linear equation solving.

I am currently outsheeting all my data as an ascii
file and then reading it into matlab. is this the best
way to do this because i really have quite a lot of
data and it can be quite tedious, especially as my
data often has a structure which i want to exploit -
for example, i want variables with the same prefix
(e.g. ing001, ing002, ... ing100) to be columns of a
matrix,etc.

Does anyone know of a better way to do this? Thanks!

Simone Chang






___________________________________________________________ ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.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/


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