Hi i am having trouble with matlab figuring out a code to plot a graph with conditions

x in (0,10)

i want a code for

f(x - 2) = 2 for 0 <x-2<2

f(x - 2) = 1 for 2 <x-2<10

so i want to plot this for varying x

can anyone help me with the code

thanks