title: Substitute variables with random numbers
body: <p>From a computation in Mathematica I got a huge matrix with numbered variables of the form <code>a[1],...,a[100]</code> in some of the entries. I would like to import this matrix as a <em>template</em> to matlab and then substitute random numbers (normally distributed) in place of the variables.  I am completely unfamiliar with the support of symbolic variables in Matlab and am not sure whether it supports indexed symbolic variables. I would need some function that searches for the <code>a[k]</code> and replaces them with a random number. </p>
  
  <p>In Mathematica I have matrices square matrices of length 2^n where which get more and more sparse as n grows and depend on 5*n (yet symbolic) variables a[k]. For n=2 the matrix is not yet sparse at all and looks like (in Mathematica-Code):</p>
  
  <blockquote>
    <p>{{a[3] + a[3], a[7] - I a[8], a[10], I a[8]},</p>
    
    <p>{I a[8], +a[6], I a[5], -I a[9] - a[8]},</p>
    
    <p>{a[7] + I a[8], +a[2], I a[5], -a[7]},</p>
    
    <p>{I a[8], a[2], a[2] + I a[15], -a[8]}}</p>
  </blockquote>
  
  <p>There exists a script <code>ToMatlab</code>which converts the Mathematica notation for matrices to the Matlab notation. I have basically all freedom in renaming the variables as it is most suitable for use in Matlab. Now I would like to create a function in Matlab which returns this exact matrix (for fixed n would be sufficient for now, so the matrix is really fixed) and replaces the a[k] with a normally distributed random number.</p>