title: how to solve scatterplot error in matlab
body: <p>following is a part of the code I am writing, </p>
  
  <pre><code>for ii=1:length(k31)
  
  B   = [k31(ii);k32(ii)];
  
  X=abs( pinv(A)*B);
  
  g1(ii)=X(1,:);
  
  g2(ii)=X(2,:);
  
  g3(ii)=X(3,:);
  
  end
  
  scatter(x(1:end-1), y(1:end-1), 5, g1);
  </code></pre>
  
  <p>But I am not able to plot the data, the error is as follows</p>
  
  <pre><code>??? Error using ==&gt; scatter at 79
  
  C must be a single color, a vector the same length as X, or an M-by-3 matrix.
  </code></pre>
  
  <p>x and y have the same dimensions as k31...but still it is showing such an error</p>