Extract first trading days of the month

1 回表示 (過去 30 日間)
Luisa Fernanda Ayala Guzman
Luisa Fernanda Ayala Guzman 2017 年 6 月 18 日
回答済み: Stephen Jue 2017 年 6 月 21 日
Hi! So I need to extract the trading data of the first day of the month but I don't know how to do it because some months start at day 4 and compare one day with the following one (when decreasing 31st to 1st) we reach a new month
what I had was
days_3 = data(((days>=1) & (days>28)),4)
I know it's not correct cause its just giving trading rates of days 29 30 31 of some months

回答 (1 件)

Stephen Jue
Stephen Jue 2017 年 6 月 21 日
What you can do instead is:
days_3 = data((days-[100; days(1:end-1)])<0,4)
This checks the difference between each successive value. When the value decreases, it signifies the start of a new month.

カテゴリ

Help Center および File ExchangeTransaction Cost Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by