How to match two date columns
Ältere Kommentare anzeigen
Eg of data:Name of dataset in my workspace is dsColShort
run_date trade_date Volume
735934 732604 100
735934 732655 200
735934 732658 50
735934 732658 100
735934 732689 400
735934 732724 600
735934 735934 700
I need to match up when column 'run_date' == 'trade_date'. I only want to show the row that matches. eg, there will be a 732604 in trade_date column that matches a separate row in run_date column but I do not want those to populate. Only if it's in the same row that they match.
any advice on what function I can use? or if I need to define any of the rows as a separate variable?
Thanks
5 Kommentare
Turlough Hughes
am 10 Okt. 2019
What type of data is it? numeric array, table, cell array?
If its a table you just write
idx=dsColShort.run_date==dsColShort.trade_date;
dsColShort(idx,1:3)
Chris H
am 10 Okt. 2019
Turlough Hughes
am 10 Okt. 2019
Can you upload the data as a .mat, or provide some sample code that generates your data.
Chris H
am 17 Okt. 2019
Turlough Hughes
am 17 Okt. 2019
No problem :)
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Dates and Time finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!