Octave, 28 bytes
@(x,y)printf(['%.',y,'f'],x)
Takes the first input as a number and the second as a string. Creates a formatting string: %.yf by concatenation, where y is the input that specifies the number of decimals. x is the input number that will be printed.