count the number of new listings and delistings across time
    3 views (last 30 days)
  
       Show older comments
    
    Qian cao
 on 24 Dec 2015
  
    
    
    
    
    Edited: Walter Roberson
      
      
 on 29 Dec 2015
            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
0 Comments
Accepted Answer
  Azzi Abdelmalek
      
      
 on 24 Dec 2015
        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 Comments
More Answers (0)
See Also
Categories
				Find more on Calendar in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
