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 Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by