I have a plot which defines line properties based on test parameters. For example, in the plot below, blue lines have a value of A=1, and red is A=2. The solid lines with dots have B=10 and dashed with Xs B=20. When I create a legend, it makes an entry for each line plotted. I would like to have a legend something like this:
[blue] A=1
[red] A=2
-. B=10
--x B=20
I have many more entries than what you see below, so this would save a lot of space. Does anyone know if this is possible in Matlab?

UPDATE
Here's what I've tried towards Eitan's answer, to no luck.
figure(2);
plot(1:5,1:5,'b');
hold all;
plot(1:5,1:5,'r');
plot(1:5,1:5,'k.-');
plot(1:5,1:5,'kx--');
h = get(gca,'Children');
M = {'A=1','A=2','B=10','B=20'};
figure(1);
legend(h,M); % This makes the legend appear in Figure 2, but I want it in 1.