pick columns with a index vector
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi I have a 30x100 data matrix and a 1x100 index vector with 1s in some columns and 0 elsewhere. How can I pick up columns in the data matrix corresponding to the 1s in the index vector. Thanks in advance.
댓글 수: 0
답변 (1개)
Azzi Abdelmalek
2014년 1월 9일
편집: Azzi Abdelmalek
2014년 1월 9일
%Example
A=rand(30,100)
B=randi([0 1],1,100)
%----------------------
out=A(:,logical(B))
댓글 수: 3
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!