match the date from two files
Afficher commentaires plus anciens
Hi I am about to perform an event study and I need to calculate abnormal stock returns for about 500 U.S. companies. I have two matrices, one with returns, the other with events. the first column contains dates and the first row the name of company in both matrices. Now I need to find the return on the day of the event for specified company. Could someone help me? I tried to do this with find () but its not working. Thanks in advance for all hints.
Réponses (2)
the cyclist
le 11 Juin 2013
I think you should be able to do this with the ismember() command. The syntax will be roughly
[tf,index] = ismember(event(:,1),return(:,1));
The index will tell you which row in return it found the same first column value as it found in the first column of event.
Sean de Wolski
le 11 Juin 2013
Use datenum to convert the dates to serial datenumbers if they are not in this form already. Then use ismember to identify dates that are members of both:
doc datenum
doc ismember
Catégories
En savoir plus sur Dates and Time dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!