title: Stop Matlab from treating a 1xn matrix as a column vector
body: <p>I'm very frustrated with MATLAB right now. Let me illustrate the problem. I'm going to use informal notation here.</p>
  
  <p>I have a column cell vector of strings called <code>B</code>. For now, let's say <code>B = {'A';'B';'C';'D'}</code>.</p>
  
  <p>I want to have a matrix <code>G</code>, which is m-by-n, and I want to replace the numbers in <code>G</code> with the respective elements of <code>B</code>... For example, let's say <code>G</code> is <code>[4 3; 2 1]</code></p>
  
  <p>Let's say I have a variable <code>n</code> which says how many rows of <code>G</code> I want to take out.</p>
  
  <p>When I do <code>B(G(1:2,:))</code>, I get what I want <code>['D' 'C'; 'B' 'A']</code></p>
  
  <p>However, if I do <code>B(G(1:1,:))</code> I get <code>['D';'C']</code> when what I <em>really</em> want to get is <code>['D' 'C']</code></p>
  
  <p>I am using <code>1:n</code>, and I want it to have the same behavior for <code>n = 1</code> as it does for <code>n = 2</code> and <code>n = 3</code>. Basically, <code>G</code> actually is a <code>n</code>-by-1500 matrix, and I want to take the top <code>n</code> rows and use it as indexes into <code>B</code>.</p>
  
  <p>I could use an if statement that transposes the result if <code>n = 1</code> but that seems so unnecessary. Is there really no way to make it so that it stops treating my 1-by-n matrix as if it was a column vector?</p>