Skip to content

generating a matrix after a for loop..

2 messages · John Seppänen, Greg Snow

1 day later
#
Let me see if I understand your question.

You want to run your simulation function (mclustSim) several times and collect the resulting vector from each run into a matrix. Is that correct?

In that case you can just you the replicate command (as long as your function returns the same length vector each time).  It runs a command or function multiple times and simplifies the results (into a matrix if the return is a vector).

Something like:
Hope this helps,