Expert Answer:
s:
You can also turn off handle visibility. This is way easier than having to set every plot as h1 = ...
Example:
x1 = randperm(10); y = randperm(10); x2 = randperm(10); plot(x1, y, '-', 'Color', 'black', 'HandleVisibility', 'off') hold on plot(x2, y, '-', 'Color', 'green', 'DisplayName', 'Put This In Legend') lgd = legend; set(lgd, 'Location', 'best')