Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: RE: Transferring non real matrice from Mata to Stata.
From
Nick Cox <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
st: RE: Transferring non real matrice from Mata to Stata.
Date
Thu, 7 Jul 2011 15:01:01 +0100
Sorry, but it can't be done.
Stata supports matrices of real numbers _only_: no strings, no complex numbers. In Stata you can hold strings in string scalars, macros, characteristics and variables, but not in matrices.
A larger question is what leads you to think otherwise. See e.g. [U] 14.1.1:
"Stata's definition of a matrix includes a few details that go beyond the mathematics. To Stata, a matrix is a named entity containing an r X c (0 < r <= matsize, 0 < c <= matsize) rectangular array of double-precision numbers (including missing values) that is bordered by a row and a column of names."
Nick
[email protected]
Amadou DIALLO
I'm trying to send a non real matrice to Stata using st_matrix but
this is not working.
Some help may be handy.
Thanks.
. mata
------------------------------------------------- mata (type end to
exit) -----------------------------------
: A = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
"."\"yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"\1
type mismatch: string \ real not allowed
r(3000);
: A
1
+---------------------------------------------------------+
1 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
2 | . |
3 | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy |
+---------------------------------------------------------+
: A = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
"."\"yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
: A
1
+---------------------------------------------------------+
1 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
2 | . |
3 | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy |
+---------------------------------------------------------+
: B = 1\2\3
: C = strofreal(B)
: C
1
+-----+
1 | 1 |
2 | 2 |
3 | 3 |
+-----+
: D = A,C
: D
1
+---------------------------------------------------------
1 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2 | .
3 | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
+---------------------------------------------------------
2
---------------------------------------------------------+
1 1 |
2 2 |
3 3 |
---------------------------------------------------------+
: st_matrix("D",D)
st_matrix(): 3253 nonreal found where real required
<istmt>: - function returned error
r(3253);
: end
-------------------------------------------------------------------------------------------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/