A completed crossword puzzle is a string matrix. So if you wanted a
convenient way of storing and printing crossword puzzles, it would be
nice to have a "smatrix list" command. Also, if there were a command to
replace the letters with blanks, (with a special character for the
"blackened" squares) you could print the puzzle and the solution.
Al Feiveson
-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of William
Gould, StataCorp LP
Sent: Tuesday, May 15, 2007 8:28 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: how can I make a string matrix?
Edgard Alfonso Polanco Aguilar <e-polanc@uniandes.edu.co> writes
> I'm working is Stata9 SE and I need to create a string matrix. Stata's
> matrix commands don't allow me to make such a thing and I've tried
> defining it on Mata and then call it from Stata but I haven't found a
> way to do it. Does anybody knows a command or a way to make such a
thing?
My first reaction is to agree with Maarten Buis
<maartenbuis@yahoo.co.uk> who wrote, "Why do you think you need a string
matrix? Stata is designed in such a way that it is extremely rare that
you need such a thing." Maartin's point is that there may be an easier
way to Solve Edgard's problem.
Edgard didn't didn't say what he wanted to do with the matrix in Stata,
so let's just assume Edgard will need the elements one a time. One way
from Stata to access the [1,3] element of global Mata matrix A, and
store the result in local macro -mymac-, is
. mata: st_local("mymac", A[1,3])
After that, in Stata, one would refer to `mymac' (in single quotes) to
obtain the contents, as in
. display "The 1,3 element is `mymac'"
To store the contents of local macro mymac in preexisting matrix B, say
element B[2,7], one could code
. mata: B[2,7] = "`mymac'"
I emphasize that the above -- use of Mata, global matrices, macros, and
element-by-element access from Stata -- is not the way Mata is usually
used.
-- Bill
wgould@stata.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/