<Note: I think this might be a database question, but I'd like to know if I can do what I wanted using Matlab tables.>
I have a table that includes a variable that has a unique value for each row - let's call it the 'key'. I have determined that I am interested in the rows that match a given array of values for the key, and I'd like to retrieve data for for those rows. I can easily do this in a for loop:
myKeys = [1;3;7;8;9];
myData = NaN(5,1);
for n = 1:5
myData(n) = myTable.Var1(myTable.key==myKeys(n));
Is there any way to do this without an explicit for loop? It feels like I should be able to use logical indexing in some way, but I haven't come up with it.