필터 지우기
필터 지우기

pick columns with a index vector

조회 수: 2 (최근 30일)
Linden
Linden 2014년 1월 9일
댓글: Azzi Abdelmalek 2014년 1월 9일
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.

답변 (1개)

Azzi Abdelmalek
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
Linden
Linden 2014년 1월 9일
Worked, thanks a lot.
Azzi Abdelmalek
Azzi Abdelmalek 2014년 1월 9일
Ok, then mark the answer as accepted

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by