title: Initializing a matrix with a certain value in matlab
body: <p>I have this matrix A of size 100x100. Now I have another vector Z=(1,24,5,80...) which has 100 elements. it is a column vector with 100 elements. Now for each row of the matrix A, I want its A(i,j) element to be 1 where i is the row from 1:100 and j is the column which is given by Z</p>
  
  <p>So the elements that should be 1 should be 
  1,1
  2,24
  3,5
  4,80 
  and so on</p>
  
  <p>I know I can do it using a loop. But is there a direct simple way I mean one liner?</p>