Assign 2D matrix to 3D matrix


#1

Hi all,

I am new to SciDB. I have a question on how to copy a 2D matrix into 3D matrix.

The 3D matrix V is with size of (1951, 100, 306), defined as:
‘V’,23,‘Vf0:double i=0:1950,1000,0,j=0:99,1000,0,k=0:305,1000,0]’,true

The 2D matrix, X, is a 2D image of size (1951, 306), as follows:
‘X’,19,‘Xf0:double [i0=0:1950,1000,0,i1=0:305,1000,0]’,true

I want to save a series of X into V, for example:

store(X, V[:,1,:])

However, it does not work. Is there any statement can do this? Please help.

Thanks,
yingwei


#2

Hi,

Yes you can do something like this:

insert(redimension(apply(X, j, 1), <f0:double> [i0=0:1950,1000,0, j=0:99,1000,0, i1=0:305,1000,0]), V)

If these matrices are fully dense, I recommend you revise your chunk sizes slightly. Perhaps something like [i0=0:1950,1000,0, j=0:99,1,0, i1=0:305,1000,0]. This way each new insert is a brand new chunk, storage footprint will be much nicer.