Subsetting a row of a matrix according to conditions in another row
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
LEONARDO CIAMBEZI
le 22 Mar 2023
Réponse apportée : Matt J
le 22 Mar 2023
I have a matrix in which the first row is some kind of index (let's say ranging from 1 to 50) and the second row is some varible y, like this:
t = repmat(1:50,1,50)
M = [ t ; y ]
I want to extract those entries of y which correspond to a given subset of the indexes, like
y([such that the corresponding t entry = to some subset of 1:50])
Is there some efficient way to do it avoiding loops or heavy demanding scripts?
Thank you
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices 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!