Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Can I join with 1 variable and 1 value as "keyword"?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi!
Can I match by dates and by country names?
I've matched by dates, but the code capture all countries.
Thanks
1 comentario
Adam Danz
el 29 de Mayo de 2020
Images of text are always really hard to work with. Copying the text directly is much better (just FYI for future posts).
Respuestas (1)
Adam Danz
el 29 de Mayo de 2020
isMatch = dateMatches && ismember(T.Country, {'Austria','Belgium'});
Replace dateMatches with your date-matching code that produces a logical vector of date matches.
Replace T with your table name and list the countries you'd like to match.
isMatch is a logical vector of row-matches.
2 comentarios
Adam Danz
el 31 de Mayo de 2020
Editada: Adam Danz
el 2 de Jun. de 2020
I thought you had alread done that. In your question, "I've matched by dates, but the code capture all countries.".
If you have a list of dates D and a 2nd list of dates D2, to find the dates in D that are listed in D2,
ismember(dateshift(D,'start','day'), dateshift(D2,'start','day'))
If you're trying to find all dates in D that are within range of date1 to date2,
D >= date1 & D <= date2;
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!