How so subset observations in a matrix?
Show older comments
I have a matrix that has the follwing columns:
[GVKEY FYEAR SALE ASSET]
FYEAR ranges from 2005-2019 and there are many GVKEYs which are basically identifiers. I want to keep only those GVKEYS(observations) for which I have the entire 2005-2019 observations, as some may have only sub ranges like 2007-2009.
How do I do this?
Accepted Answer
More Answers (1)
KSSV
on 25 Jul 2022
idx = FYEAR >= 2007 & FYEAR <= 2009 ;
iwant_FYEAR = FYEAR(idx) ;
iwant_GVKEYS = GVKEYS(idx) ;
Categories
Find more on Matrix Indexing 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!