match the date from two files

1 view (last 30 days)
Iza
Iza on 11 Jun 2013
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.

Answers (2)

the cyclist
the cyclist on 11 Jun 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
Sean de Wolski on 11 Jun 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

Categories

Find more on Dates and Time in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!