removing zeros

short = cell and it contains mostly numbers:
[ 0]
[ 0]
[ 0]
[-673.12]
[ 0]
[ 0]
[ 0]
[ 0]
[ 0]
how do you clear zeros out of a cell array? when I try short(short == 0) = []; I get this error:
Undefined function 'eq' for input arguments of type 'cell'.

Réponses (1)

Jan
Jan le 6 Avr 2012

0 votes

C = {0, -673.12, 0};
C = C(cellfun(@any, C));

Catégories

En savoir plus sur Data Types dans Centre d'aide et File Exchange

Question posée :

le 6 Avr 2012

Community Treasure Hunt

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

Start Hunting!

Translated by