Hi!
I have a matrix called M with dimension (586,100,100). I would like to split
and save this into 586 matrices with dimension 100 by 100.
I have tried the following for loops but couldn't get it work..
l-dim(M)[1]
for (i in (1:l)){
save(M[i,,],file = M_[i].img)
}
Can somebody help me with
Hi,
On Sun, Nov 21, 2010 at 9:27 PM, Hana Lee hana...@email.unc.edu wrote:
Hi!
I have a matrix called M with dimension (586,100,100).
First of all, In R it is only an object with *two* dimensions that is
called matrix. Anything with two or more dimensions is called an
array. Example:
x -
Hi Hana,
Use the paste function to create your file names.
for ( i in 1:dim(M)[1] ) save( M[i,,], file=paste(M_, i, .img, sep=) )
Alternatively, use the sprintf function to get names with leading
zeroes for easier sorting of files:
for (i in 1:dim(M)[1] ) save( M[i,,], file=sprintf(M_%03d.img,
Sorry, I did a mistake corrected below.
On Sun, Nov 21, 2010 at 9:50 PM, hb h...@biostat.ucsf.edu wrote:
Hi,
On Sun, Nov 21, 2010 at 9:27 PM, Hana Lee hana...@email.unc.edu wrote:
Hi!
I have a matrix called M with dimension (586,100,100).
First of all, In R it is only an object with *two*
On Nov 22, 2010, at 12:27 AM, Hana Lee wrote:
Hi!
I have a matrix called M with dimension (586,100,100).
In R you have an array (not a matrix) wehn the number of dimensions is
3.
I would like to split
and save this into 586 matrices with dimension 100 by 100.
I have tried the
5 matches
Mail list logo