How can I re-save variable with only certain index values?
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Mary Hemler
le 5 Juin 2020
Modifié(e) : Cam Salzberger
le 5 Juin 2020
I have a variable, mutualInfoTotal, and I would like to re-save as another variable HD_mutualInfoTotal that only contains the values of mutualInfoTotal that correspond to the following index numbers in mutualInfoTotal: [1:4, 6, 8:10, 12, 15:18, 20:22]. How can I do this?
0 commentaires
Réponse acceptée
Cam Salzberger
le 5 Juin 2020
Modifié(e) : Cam Salzberger
le 5 Juin 2020
HD_mutualInfoTotal = mutualInfoTotal([1:4, 6, 8:10, 12, 15:18, 20:22]);
There are a lot of ways to do indexing in MATLAB, and this is one of the most common. If you came up with those index values by using find, consider using logical indexing instead.
-Cam
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing 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!