필터 지우기
필터 지우기

count the number of new listings and delistings across time

조회 수: 1 (최근 30일)
Qian cao
Qian cao 2015년 12월 24일
편집: Walter Roberson 2015년 12월 29일
Dear there, Happy Christmas. Could you gift me by helping me to solve my problem:) haha.
I have the following price matrix, with rows for time from date 1 to date 7 and columns for 5 assets. The values available in each column means the asset is traded on the market. For asset 1, it is listed on date 4 and is delisted on date 6. Asset 2 is listed on date 1 and not listed. Asset 3 is listed on date 1 and listed on date 4...so on...I want to know to summarize how many assets are newly listed and how many are just right delisted from the market over time.The result is expected be two vectors,one is new=[2 0 1 1 0 1 0] and the other is new delisting=[0 0 0 1 0 1 0].
Thank you very much. I am waiting online for your answers.
p2 =
NaN 2 4 NaN NaN
NaN 1 1 NaN NaN
NaN 3 1 1 NaN
1 4 NaN 1 NaN
2 2 NaN 2 NaN
NaN 1 NaN 3 2
NaN 1 NaN 4 2

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2015년 12월 24일
p2 =[ NaN 2 4 NaN NaN
NaN 1 1 NaN NaN
NaN 3 1 1 NaN
1 4 NaN 1 NaN
2 2 NaN 2 NaN
NaN 1 NaN 3 2
NaN 1 NaN 4 2]
ii=~isnan(p2);
new=sum([ii(1,:) ;diff(ii)]==1,2)
new_delesting=sum([ii(1,:) ;diff(ii)]==-1,2)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Financial Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by