MATLAB: How to make user defined x-values with corresponding y-values

plottinguser input

I have two graphs with the same x-axis, years from 2001 to 2010. All I need is to have the user change which years, to and from, that they want to see, and have the graphs display that interval with all of the y-values. Essential it will zoom in on those parts of the graphs.
I can get the user defined x-values but I don't know how to match the y-values here with the graphs.
plot((startyear:endyear),y)

Best Answer

  • I suggest using the axis function.