필터 지우기
필터 지우기

How to remove zeros from non linear array

조회 수: 1 (최근 30일)
Sarumathi C
Sarumathi C 2018년 3월 14일
답변: Walter Roberson 2018년 3월 14일
How to remove more zeros from each row of non linear array. we have [1269*100] array structure. my output is like [1 2 3 0 0; 1 4 0 0; 1 2 3 0 0]. I need the output of each row like [1 2 3; 1 4; 1 2 3].
  댓글 수: 3
Sarumathi C
Sarumathi C 2018년 3월 14일
No sir I need to remove all zeros from each row and only pick non zero values in each row. Because I need to find difference between two rows when the row 1 and row 2 have same number of non zero values..

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2018년 3월 14일
cell2mat( cellfun( @(V) V(V~=0), num2cell(YourArray, 2), 'uniform', 0))

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by