my Problem is difficult or too simple. So I've been using sparse to creat a matrix from different vectors (example here)
I use sparse(i,j,s,m,n)
where i
and j
are allocations for particles i derived with floor etc.
(it is particle in cell simulation).
this is for 1D
. I want to vectorize this problem for 2D and got the problem that i can't creat 3D sparse matrices in octave.
I'm really no pro with octave and i'm searching for a solution that i can put the values from s nicely into a matrix according to the i and j values.
for example: i got particle one in cell x=2
and y=2
than i want to have a matrix with value from particle one in (1,2,2,value)
. is there a way without much if's
and for's
?