how to find value in a matrix from column and row name
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Age Height Weight
___ ______ ______
Smith 38 71 176
Johnson 43 69 163
Williams 38 64 131
Jones 40 67 133
Brown 49 64 119
Q: I want the user to input the row name and then column name to get the value intersection between them
for example if the user enter T(smith,age)
the answer will be 38
1 commentaire
Jan
le 21 Fév 2022
What is the shown table? A text file? Or a table? In the latter case, please post the code to create the table instead of this displayed text.
Réponses (1)
Cris LaPierre
le 21 Fév 2022
Modifié(e) : Cris LaPierre
le 21 Fév 2022
% create a sample table
load patients
T = table(Age,Gender,Height,Weight,Smoker,...
'RowNames',LastName)
% A couple ways to index using rownames
T{'Smith','Height'}
T.Height({'Smith','Harris'})
0 commentaires
Voir également
Catégories
En savoir plus sur LaTeX 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!