Combining Logical Indexes
Afficher commentaires plus anciens
I have two logical Indexes that I need to reference with my large Matrix of data before performingons. One Index (MyDates) is 1x693 and the other (MyTickers) is 589x1. I need to combine the two Indexes into one large 589x693 logical index. How do I go about oing that?
Thanks, Brian
Réponse acceptée
Plus de réponses (1)
Brian
le 4 Nov 2011
2 commentaires
Walter Roberson
le 4 Nov 2011
What shape were you expecting? When you extract arbitrary elements out of a matrix, there is no way for MATLAB to leave "hole" that preserve any original existing shape.
Fangjun Jiang
le 4 Nov 2011
That is expected. If you want to keep the shape of the original matrix, you need fill it with something depending on your need. For example,
a=magic(3);
b=logical([1 1 0;0 1 0;0 1 0]);
a(~b)=nan;
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!