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

1 次查看(过去 30 天)
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?

采纳的回答

Guillaume
Guillaume 2017-10-30
编辑:Guillaume 2017-10-30
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dates and Time 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by