Re: Referencing from another vector



I have a follow-up question:

suppose a = a = (1 1 2 2 2 3 3 1 3 1 4 4 1)'
and b= rand(13,2).

How can I create matrix c that show elements in b where the
corresponding element in a==1.

I tried c = b(a==1), but that creats the output in a SINGLE column
(stacks observations from columns 1 and 2 from b. Any help would be
appreciated!!

cb
.