フィルターのクリア

pick columns with a index vector

1 回表示 (過去 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 Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by