title: taking function with vector argument and defining new anonymous function with arbitrary subset of vector members as arguments
body: <p>I have a function <code>vector_function</code> that takes a 1 by 6 vector variable as its only argument. I would like to define an anonymous function <code>anon_fun</code> based on <code>vector_function</code> that specifies certain members of the 1 by 6 vector as arguments and assigns default values to the rest.</p>
  
  <p>For example, if I wanted to create <code>anon_fun</code> using the first three members of the 1 by 6 vector variable as input arguments, I could write:</p>
  
  <pre><code>% Define default variable values.
  var_def = [1,2,3,4,5,6];
  
  % Set which variables to use as arguments.
  var_flag = [true,true,true,false,false,false];
  
  % Define anonymous function that takes 
  anon_fun = @(var)...
  vector_function([var(1),var(2),var(3),var_def(4),var_def(5),var_def(6)]);
  </code></pre>
  
  <p>Is there a way to handle all 2^6 = 64 possible permutations of <code>var_flag</code>? I could change the way <code>vector_function</code> takes input, but that will require significant recoding.</p>