title: Add error bars to grouped bar plot in MatLab
body: <p>I have a simple, grouped bar plot. I'm trying to plot the error bars, too, but I can't seem to figure it out. </p>
  
  <p>I'm not too great with for loops, but I don't know if that's the only solution to this, or if I can just add another line of code to plot the error bars. </p>
  
  <p>Here's my code and graph:</p>
  
  <pre><code>% Plot raw data
  y = [316.45 292.14 319.96; 305.59 287.99 295.21]  % first 3 #s are pre-test, second 3 #s are post-test
  err = [13.12 5.67 12.36; 12.43 6.83 11.67]
  
  box on
  
  bar(y)
  set(gca,'xticklabel',{'Pre-test'; 'Post-test'}) 
  ylim([200 360])
  ylabel('RT (ms)')
  xlabel('Session')
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/WUjoz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WUjoz.png" alt="enter image description here"></a></p>