Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

match the date from two files

Asked by 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.

0 Comments

Iza

Tags

Products

No products are associated with this question.

2 Answers

Answer by 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.

0 Comments

the cyclist
Answer by 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

0 Comments

Sean de Wolski

Contact us