First, let's fix your starting point. As I said, for what you're doing tables are the wrong storage. They're more complicated to use and use more memory. Ideally, you'd go back to whichever code created your a tables so that a) they're not numbered and b) they're matrices. So instead of tables, we're going to use matrices. Since your matrices are 2D and have all the same size, the simplest is to store them all in a single 3D matrices:
allmatrices = cat(3, table2array(a1), table2array(a2), table2array(a3), table2array(a4), table2array(a5), table2array(a6));
Numbered variables forces you to repeat the same code many times, as you can see above. Always a bad idea...
I'm still unclear of your goal.
If you want to keep only the rows that are all ones, it's simply:
selectedrows = allmatrices(all(allmatrices == 1, [2 3]), :, :);
which will output a ?x100x6 matrix with only the rows containing all ones.
If you want to keep only the rows that sum to 100, it's simply:
selectedrows = allmatrices(sum(allmatrices, [2 3]) = 100, :, :);
Best Answer