title: How to assign vectors (along the fourth dimension) to pre-specified subscripts
body: <p>I have a matrix of x,y,z matrix coordinates as well as a matrix of row vectors corresponding to timeseries associated with these coordinates. E.g.</p>
  
  <pre><code>coordinates = [1 2 3; 57 89 22]; % Where the column 1 = x, column 2 = y, column 3 = z
  timeseries = rand(2,200); % where each row corresponds to the timeseries of the coordinates in the same row in the coordinates matrix.
  </code></pre>
  
  <p>I want to build a 4D matrix containing these timeseries. Any unassigned coordinate should default to a vector of zeros. Currently I do this as follows: </p>
  
  <pre><code>M = zeros(100,100,100,200); 
  for ii = 1:size(coordinates,1)
      M(coordinates(ii,1),coordinates(ii,2),coordinates(ii,3),:) = timeseries(ii,:);
  end
  </code></pre>
  
  <p>This works, but I was wondering if there is a (more readable/efficient) method to write the for-loop in a single step. I've tried using logical arrays and indices, but it always fails because I'm assigning vectors, not scalars. </p>