Effacer les filtres
Effacer les filtres

pick columns with a index vector

2 vues (au cours des 30 derniers jours)
Linden
Linden le 9 Jan 2014
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.

Réponses (1)

Azzi Abdelmalek
Azzi Abdelmalek le 9 Jan 2014
Modifié(e) : Azzi Abdelmalek le 9 Jan 2014
%Example
A=rand(30,100)
B=randi([0 1],1,100)
%----------------------
out=A(:,logical(B))
  3 commentaires
Linden
Linden le 9 Jan 2014
Worked, thanks a lot.
Azzi Abdelmalek
Azzi Abdelmalek le 9 Jan 2014
Ok, then mark the answer as accepted

Connectez-vous pour commenter.

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by