Can I specify the variable name to use as a key when I use innerjoin() or does it have to be a column number?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
T4H14
el 30 de Oct. de 2017
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?
0 comentarios
Respuesta aceptada
Guillaume
el 30 de Oct. de 2017
Editada: Guillaume
el 30 de Oct. de 2017
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Dates and Time en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!