Delete zero columns in images

1 回表示 (過去 30 日間)
majed majed
majed majed 2016 年 3 月 27 日
コメント済み: majed majed 2016 年 3 月 28 日
How are you everyone! I need your help to solve this problem :
If I have an image which contains columns with all elements equal to zero , how can delete the columns?
For example , if I have the image
A= [ 1 0 2 3 4 ;0 0 5 4 3 ;5 0 7 6 5;3 0 4 3 0]
How can I delete the second column ? The result I want is
AA=[1 2 3 4 ;0 5 4 3 ;5 7 6 5 ;3 4 3 0]
Any answer will be appreciated Thank you.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 3 月 27 日
編集済み: Azzi Abdelmalek 2016 年 3 月 27 日
A= [ 1 0 2 3 4 ;0 0 5 4 3 ;5 0 7 6 5;3 0 4 3 0]
AA=A(:,any(A))
  2 件のコメント
Guillaume
Guillaume 2016 年 3 月 27 日
Or
A(:, ~any(A)) = [];
To actually delete the columns.
majed majed
majed majed 2016 年 3 月 28 日
Thank you brother for your answer

サインインしてコメントする。

その他の回答 (1 件)

Muhammad Usman Saleem
Muhammad Usman Saleem 2016 年 3 月 27 日
A= [ 1 0 2 3 4 ;0 0 5 4 3 ;5 0 7 6 5;3 0 4 3 0]
A =
1 0 2 3 4
0 0 5 4 3
5 0 7 6 5
3 0 4 3 0
A(:,2)=[];
A =
1 2 3 4
0 5 4 3
5 7 6 5
3 4 3 0
  1 件のコメント
majed majed
majed majed 2016 年 3 月 28 日
Thank you bro for answering

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by