MATLAB: Can I specify the variable name to use as a key when I use innerjoin() or does it have to be a column number

column numberinnerjoinkeystable operationsvariable name

Can I use innerjoin(A,B,'Keys','Date') or do I have to use innerjoin(A,B,'Keys'1) when innerjoining two tables which have a commom first colunn called Date (with datetime variables)? Is there any advantage or disadvantage to doing it one way or the other?

Best Answer

It's all very well documented. keys can be a positive integer index, a vector of positive integer indices, a character vector of the name of the column, a cell array of character vectors of the names of the column or a logical vector.
It's the same syntax you use to refer to any column of a table, which is all explained in access data in a table.
There may be a negligible speed difference between the methods but nothing worth worrying about. As it's not documented, this could change from version to version. So, use whichever method is more convenient for you.
edit: of course, using numeric or logical indexing means that the key(s) must be the same column index(es) in both tables. With a char array or cell array of char arrays they don't have to be.