how to select corresponding values to a column
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Usama Bin Khalid
il 15 Mar 2021
Commentato: David Hill
il 16 Mar 2021
I have a data set with x and y...like 100 each in a column...x is a number..y is a value of a paramter
for x i have selected specific values say i have selected 1,15,30,45,60,75,90,100
now i want matlab to select corresponding values of y that are to x...
i know its simple but am dealing with something complex..juts need to know the quick answer. Thanks
0 Commenti
Risposta accettata
David Hill
il 15 Mar 2021
yourMatrix=[(1:100)',randi(100,100,1)];
y=yourMatrix([1,15,30,45,60,75,90,100],2);
2 Commenti
David Hill
il 16 Mar 2021
yourMatrix=[(1:100)',randi(100,100,1)];
y=yourMatrix(ismember(yourMatrix(:,1),[1,15,30,45,60,75,90,100]),2);
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!