I'm not sure what you mean by assign same name to them. It sounds like you haven't completely understood the concept of tables.
Note that 'RowNames' assign names to rows of the table, whereas a1 and a2 will end up as columns (variables) of the table. In any case, Matlab does not allow tables to have two rows or variables with the same name. They're not designed for that.
As the documentation of table clearly says, 'Rownames' must be a cell array of character vectors *that are nonempty and distinct' and the numbers of character vectors must equal the number of rows. The same applies to 'VariableNames'. What you can do instead is create another variable (e.g. called labels) in your table to which you assign your labels. You can even use this labeling column with functions such as rowfun and varfun, with the 'GroupingVariable' option to perform the same operation on each group of rows.