How to eliminate column of the matrix?

조회 수: 1 (최근 30일)
Karanvir singh Sohal
Karanvir singh Sohal 2021년 3월 16일
답변: the cyclist 2021년 3월 16일
Hello everyone!
I have generated some matrix of size say mxn. I want to eliminate the columns which have all values equal to "0".
For example:
A=[ 1 2 3 ... 2 0
2 3 5 ... 3 0
3 5 6 ... 3 0]
Desired output
A=[1 2 3 ... 2
2 3 5 ... 3
3 5 6 ... 3]

채택된 답변

the cyclist
the cyclist 2021년 3월 16일
A(:,all(A==0)) = []

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by