- You need to write contains twice: it's not contains(thing,otherthing) & thing2,otherthing2 but instead contains(thing,otherthing) & contains(thing2,otherthing2)
- You need a to tell MATLAB that you want the whole row, that means specifying a ,: when you provide the rows. That is T(rows,columns) and columns is all (even though you can't remove a partial row in a table).
- contains is probably not exactly what you want here, but maybe suitable enough for your purposes. contains will match 11_right and also 311_right if you had that, because the latter 'contains' the former. Consider using strcmp or ismember for the more precise match. Even though it's maybe irrelevant for this dataset, one day you might copy this code and then you'll have potential for a scary hidden bug.
- It's easier with this kind of logic to define some index variables, that can help you debug a little. Here I broke it into 2 variables, but you could even break it into 3 (making the earlyP3 one a variable too). I wasn't creative with the names!
- You don't need to force your chars into strings as MATLAB will figure it out when you say contains, nothing wrong with this though!