[Eeglablist] plotcurve.m - error in setting ordinate limits

Johnson, John T. john.johnson at gatech.edu
Wed May 29 13:11:40 PDT 2019


In plotcurve.m, line 215, there is an attempt to set the y limits of the plot, but the variables used have more elements than expected.

  % ordinate limits
  % ---------------
  if isempty(g.ylim),
      yll = min(reshape(R, [1 prod(size(R))]));
      ylh = max(reshape(R, [1 prod(size(R))]));
      yll2 = yll - (ylh-yll)/10;
      ylh2 = ylh + (ylh-yll)/10;
      if ~isnan(yll), g.ylim = [yll2 ylh2]; end
  end
  if ~isempty(g.ylim) && length(g.ylim) == 2
      if any(g.ylim)
          ylim(g.ylim);
      else
          ylim([0 1]);
          axis off;
          box off;
      end
  elseif ~isempty(g.ylim)
      yl = ylim;
      ylim([g.ylim yl(2)]);      <———— Error
  end
  yl = ylim;


The error message is Error using ylim (line 31) Limits must be a 2-element vector of increasing numeric values.
Inspecting g.ylim shows that it has four elements, rather than the expected single element.

To work around the error, I can do this:

  elseif ~isempty(g.ylim)
      yl = ylim;
      yl_min = min([g.ylim yl]);
      yl_max = max([g.ylim yl]);
      ylim([yl_min yl_max]);
  end
  yl = ylim;


But the lower limit is too low. Is there a better option?

This happens in both 13.6.5b and 2019.0.

Thanks,
John


More information about the eeglablist mailing list