I am attempting to create a number of parameter arrays using the `eval` function in MATLAB

Essentially, I have a big dataset (`data`) which I am attempting to split into a number of smaller datasets, with names which are generated using a loop. As it stands, I am using:

```
variablename = ['a' num2str(academy) '_s' num2str(year) '_g' num2str(gender)];

        %loop through all people, if match various classifications, write to variablename
        for row = 1:totalrows;
            if data(row,2) == academy;
                if data(row,1) == year;
                    if data(row,70) == gender;
                         eval([variablename ' = [ data(row,8) data(row,9) data(row,73) data(row,76) data(row,77) data(row,78) data(row,79) ]; ' ]); % ; supresses output (i.e. stop it showing value of each variable                     

                    end%gender if
                end%year if
            end %academy if
        end %row loop

```

This works reasonably well, except that each time I get a second record matching all `if` statements, it overwrites the first set of data. 

So my question is, how can I specify the row of the variable created using `eval` to which i want to write my data?

Thanks in advance