Displaying 1 result from an estimated 1 matches for "smat2".
Did you mean:
mat2
2007 Jun 23
1
Creating different matrices in a loop
...t . I have to loop though the rows in
the matrix and create DIFFERENT matrices each time I go through the loop.
counts=c(4,6,10);
p=1;
for (i in 1:length(counts))
{
smat=bmat[p:p+i-1,];
p=p+i;
}
The problem is smat overwrites itself each time inside the loop. I would
like to have smat1, smat2, smat3 instead of a single vector smat. Basically
I wanted to change the name of the matrix "smat" each time the loop runs so
that i will have 3 different matrices.
Any help will be very much appreciated.
Thanks,
Suman
[[alternative HTML version deleted]]