Matrix to row vector

Hello all,

I have two matrices

A = [1 1 1; 1 1 1; 1 1 1]
B = [1; 2; 3]

I want to multiply both of them row by row, meaning the answer should be

A.*B = [1 1 1; 2 2 2; 3 3 3]

Now I want to covert this matrix to a row vector like this

Z = [1;1;1;2;2;2;3;3;3]

How can i do that? any suggestions? thank you

vec((A .* B)')

(Note that Julia arrays are stored by column, so if you are coming from Python where arrays are stored by row you might consider transposing your array layouts for efficiency.)

Thank you :slight_smile: