title: Create list of arguments for function with variable number of inputs
body: <p>My problem: I have written a function which uses the varargin syntax, which is explained <a href="http://de.mathworks.com/help/matlab/ref/varargin.html" rel="nofollow" title="here">here</a>. Now I am stuck with the problem how to create a list of arguments which I can pass to this function. The setting is comparable to this:
  Say I have a function</p>
  
  <p><code>matrixmult(A, varargin)</code></p>
  
  <p>which determines the product of arbitrary many matrices with the matrix A. Now I want to determine the product of A with n matrices, where n is set previously in the code. It looks like this:</p>
  
  <pre><code>n=4;
  A=eye(5);
  B=ones(5);
  matrixmult(A, ?)
  </code></pre>
  
  <p>What do I have to write instead of ? in order to receive the same result as this:</p>
  
  <pre><code>n=4;
  A=eye(5);
  B=ones(5);
  matrixmult(A,B,B,B,B)
  </code></pre>
  
  <p>Google didn't help as variable input always leads to questions about how to use varargin and not how to pass arguments which are created in sort of a loop.
  I tried various things such as creating a string ',B' and repeating it several times in order to use eval(string). 
  If this should be a duplicate please DO mark it.
  Thanks for your help in advance.</p>