function G = csv(name)

  if (index(name, ".csv"))
    fn = name;
  else
    fn = [name ".csv"];
  endif
  
  G = csvread(fn, 0, 0);

  while (size(G,2)>1 && G(1,1)==0)
    G=G(2:end,:);
  endwhile

  rows = size(G,1);
  columns = size(G, 2);
  
  maxrows = 500;
  
  if ( rows < maxrows )
    P = G;
  else
    warning("off");
    P = G(1:rows/maxrows:rows,:);
    warning("on");
  endif
  
  switch(columns)
    case(2)
      plot(P(:,1),P(:,2),'r','linewidth',2);
      legend('X');
      legend('boxoff');
      xlabel('Time (s)');
      title(strrep(fn,'_','\_'));
      set(gca(), 'fontsize', 16);
      set(gca(), 'linewidth', 2);     
    case(3)
      plot(P(:,1),P(:,2),'r','linewidth',2,P(:,1),P(:,3),'b','linewidth',2);
      legend('X', 'Y');
      legend('boxoff');
      xlabel('Time (s)');
      title(strrep(fn,'_','\_'));
      set(gca(), 'linewidth', 2);
      set(gca(), 'fontsize', 16);
    case(4)
      plot(P(:,1),P(:,2),'r','linewidth',2,P(:,1),P(:,3),'b','linewidth',2,P(:,1),P(:,4),'g','linewidth',2);
      legend('X', 'Y', 'Z');
      legend('boxoff');
      xlabel('Time (s)');
      title(strrep(fn,'_','\_'));
      set(gca(), 'fontsize', 16);
      set(gca(), 'linewidth', 2);
  endswitch
  
endfunction
