加入一个自动增长矩阵
示例:
Matrix=// \\;
linename={'line1';'line2';'line3'};
x=0:1:5;
for m=1:1:3
n=input('enter the line No.:');
if n==1
y=x;
elseif n==2
y=2*x;
elseif n==3
y=3*x;
end
plot(x,y,'r')
hold on
Matrix=//Matrix,n\\;
legend(linename(Matrix))
end
双斜杠为左右方括号