Adds new option to select which variables to consider for estimation

First step for ticket #336
Convert use of unique to be compatible with older Matlab version