matrix column element limiting
조회 수: 1 (최근 30일)
이전 댓글 표시
hi,
I have a matrix say 200*30. I need to limit the elements of 29th and 30th columns with different constraints. how can I do that?
thanks,
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2015년 7월 8일
Example
A=rand(200,30)
idx=A(:,29)>0.5 & A(:,30)<0.7
out=A(idx,:)
댓글 수: 4
Stephen23
2015년 7월 8일
편집: Stephen23
2015년 7월 8일
Azzi Abdelmalek's solution is much more optimized than using a loop. This is how MATLAB works best, using basic code vectorization and indexing.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!