Specify specific cell in the formula
    4 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    susman
 le 28 Sep 2020
  
    
    
    
    
    Réponse apportée : madhan ravi
      
      
 le 28 Sep 2020
            I am working with mortality tables and my question is how can I specific a specific cell (e.g. the value of the variable discount_px when the age is 77)?
I have created this table containing four variables (Age, qx, px, discount_px)
Age        qx                 px            discount_px
75      0.038258            1             1 
76      0.042116       0.96174       0.95602 
77      0.046321       0.92124       0.91031 
78      0.050916       0.87856       0.86298 
79      0.055988       0.83383       0.81417 
80      0.061493       0.78715       0.76402 
If my formula is:
A = Age * (discount_px for age 77)
my outcome should be:
A = 77*0.91031 
How can I specific in the formula that discount_px should take the value for age = 77?
0 commentaires
Réponse acceptée
  madhan ravi
      
      
 le 28 Sep 2020
        ix = TaBle.Age == 77;
A = TaBle.Age{ix, :} * TaBle.discount_px{ix, :}
0 commentaires
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Tables dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

