title: Load values from a text file in MATLAB
body: <p>I would like to load variables from a text file.</p>
  
  <p>For example, my text file, <code>varA</code>, <code>varB</code>, and <code>varC</code>.</p>
  
  <p>In MATLAB, I would like to give these variables values so that every variable is a 2x2 matrix.</p>
  
  <p>So from the text file containing the above information I would get a matrix that looks like this:</p>
  
  <pre><code>[ 1 2 3 4 5 6;
    1 2 3 4 5 6]
  </code></pre>
  
  <p>Is this possible?</p>
  
  <p>I added a second example to try to make things a little clearer.</p>
  
  <p>My text file, text.txt, looks like this</p>
  
  <pre><code>x1 x2 x3
  </code></pre>
  
  <p>In MATLAB my .m file gives the values to these variables like</p>
  
  <pre><code>x1 = [1 1; 1 1]
  x2 = [2 2; 2 2]
  x3 = [3 3; 3 3]
  </code></pre>
  
  <p>So, when I import my textfile I would get</p>
  
  <pre><code>a = (textfile)
  a = [1 1 2 2 3 3 ; 1 1 2 2 3 3]
  </code></pre>
  
  <p>I basically try to adapt a <a href="http://en.wikipedia.org/wiki/Genetic_algorithm" rel="nofollow noreferrer">genetic algorithm</a> (GA) on a very huge problem (of <a href="http://en.wikipedia.org/wiki/Travelling_salesman_problem" rel="nofollow noreferrer">travelling salesman problem</a> (TSP) type). The problem is that every variable I have is a matrix and the crossover, fitness and mutation codes get pretty complicated. And I am having problems of making a random start population as well.</p>
  
  <p>I would like to randomly select, let's say 30 variables, from a list with 256 so that the variable can only be picked once. Each variable however have their own specific values in a 2*2 matrix that cannot be changed.</p>
  
  <p>I would like to use randperm and then put an <code>x</code> before every value making them variables instead of values...</p>