Combining Logical Indexes
이전 댓글 표시
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
채택된 답변
추가 답변 (1개)
Brian
2011년 11월 4일
댓글 수: 2
Walter Roberson
2011년 11월 4일
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
2011년 11월 4일
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;
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!