You are here

Appending mxAlgebra expressions

3 posts / 0 new
Last post
Lawrence L Lo's picture
Offline
Joined: 02/24/2010 - 19:14
Appending mxAlgebra expressions

Hello,

I am trying to generate mxAlgebra expressions from a size variable. I have a variable amount of mx submodels and am trying to add the objectives from these together for a full model objective. I have tried things like
mxAlgebra(sum(get(paste("submodel",1:x,".objective",sep=""))),
name="TotObj")
and other various methods. I also tried the method described on
http://openmx.psyc.virginia.edu/thread/537
but don't think this will help in my particular situation.
Any suggestions?

Best,
-LLL

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
The trick is to construct the

The trick is to construct the expression outside of the mxAlgebra() call and then feed the expression into mxAlgebra(). The mxAlgebra() will only recognize matrix operators or functions, so it barfs on the get() and the paste(). Try this:

modelnames 
Lawrence L Lo's picture
Offline
Joined: 02/24/2010 - 19:14
Thanks a bunch. This did the

Thanks a bunch. This did the trick.

Log in or register to post comments