How does MATLAB's $\tt upfirdn$ select extra points when downsampling?
The function performs upsampling, filtering and downsampling. The reason for the extra samples is due to the fir filter delay. If you want to reproduce this behaviour for downsampling only you should do the following steps:


Take your input signal, xin and add length(h)-1 zeros at the end. This is done because of the filter's delay.
Use filter(h,1,xin_padded); to filter the signal.
Downsample the filtered signal.