MATLAB: How to choose what to plot using DropDown in App Designer

app designer

I want to use DropDown to plot these two codes:
x1 = 0:pi/100:n*pi;
y1 = sin(x);
and:
x2 = 0:pi/100:n*pi;
y2 = cos(x);
Where n value is selected using a slider. These two plots are just an example, and they're not what I want to plot. I know how to use the slider and the drop down for a single plot,
function DropDownValueChanged(app, event)
value = app.DropDown.Value;
switch value
case {1, 2, 3, 4}
end
end
but how do I change the plot shape using the drop down?

Best Answer

See the attached app for demo.