Filter löschen
Filter löschen

How to remove zeros from non linear array

1 Ansicht (letzte 30 Tage)
Sarumathi C
Sarumathi C am 14 Mär. 2018
Beantwortet: Walter Roberson am 14 Mär. 2018
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 Kommentare
Sarumathi C
Sarumathi C am 14 Mär. 2018
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..

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 14 Mär. 2018
cell2mat( cellfun( @(V) V(V~=0), num2cell(YourArray, 2), 'uniform', 0))

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by