@samantp wrote:
So, I have an array,
seed_dvh
, and a vector,dvh_coeff
, corresponding to some coefficients I’d like to multiplyseed_dvh
by.seed_dvh
is of size 1718x2 anddvh_coeff
is of length 1000.I want to create a 1000 element vector of arrays,
dvh_list
, that consists ofseed_dvh
multiplied by the numbers indvh_coeff
i.e. such thatdvh_list[1]=seed_dvh*dvh_coeff[1] dvh_list[2]=seed_dvh*dvh_coeff[2] dvh_list[3]=seed_dvh*dvh_coeff[3]
etc.
but I am not quite sure how to do this. I have tried
dvh_list=dvh_coeff.*seed_dvh
but of course this won’t work because the array sizes don’t match so pointwise multiplication is not possible.Is there a way to do this without writing a for loop?
thanks.
Posts: 5
Participants: 3