how to delete column with one number only

3 次查看(过去 30 天)
Dear All,
I need to delete the columns with only one element from this matrix,
A =[1 1 1 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 1
0 0 0 0 1
0 0 1 0 0];
I used some command find with loop but it is not correct, is there any efficient idea.
thanks in advance.
Nadia,

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2016-4-21
编辑:Azzi Abdelmalek 2016-4-21
A(:,sum(A)==1)=[]

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by