How to create an indicator function?
5 次查看(过去 30 天)
显示 更早的评论
Dear community,
I ve got following situation. I created a vector (MCxT)(MC=Monte Carlo Trials, T=time in years) which gives me the development of the population over time. I show you one Monte Carlo Trial for the next 10 years. It looks like that:
1000 990 978 968 952 937 923 905 885 864
Now comes my problem, in the next step I would like to create an indicator matrix which does the following:
1. Matrix (N x T), that means each row characterise one person, with an integer 1
2. The Matrix should be constant (N x T), in this case (1000 x 10) BUT if someone dies, which should be randomly generated, the indicator should be zero. That means in t=2, we should have 1000 rows, with 990 entry values of 1 and 10 entry values of 0.
3. And once someone passed away the 0 should be kept in that row until T.
Does anybody have an idea how to do that or could give me a hint how to start.
Would be a great help if someone knows how to get the next step from (N x T) with 1000 entries of 1 to t=2 with 990 entries of 1 and 10 of 0, so that Matlab reads that number in t=2 and knows what to do with that number.
Thank you verrrry much in advance.
Best dennis
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!