Referencing from another vector



Hi,

I have a 1x13 vector

a = (1 1 2 2 2 3 3 1 3 1 4 4 1)'

and

b = rand(1,13).

How can I create matrix c, which only shows elements of b, where the
corresponding element of a ==1?

Thank you!
.