<p>Consider the following file</p>

<pre><code>var1 var2 variable3
1     2    3
11    22   33
</code></pre>

<p>I would like to load the numbers into a matrix, and the column titles into a variable that would be equivalent to:</p>

<pre><code>variable_names = char('var1', 'var2', 'variable3');
</code></pre>

<p>I don't mind to split the names and the numbers in two files, however preparing matlab code files and eval'ing them is not an option. </p>

<p>Note that there can be an arbitrary number of variables (columns)</p>

Just use textscan with different format specifiers.
```
```
fid = fopen(filename,'r');
heading = textscan(fid,'%s %s %s',1);
fgetl(fid); %advance the file pointer one line
data = textscan(fid,'%n %n %n');%read the rest of the data
fclose(fid);
```
```
In this case 'heading' will be a cell array containing cells with each column heading inside, so you will have to change them into cell array of strings or whatever it is that you want. 'data' will be a cell array containing a numeric array for each column that you read, so you will have to cat them together to make one matrix.