omit nonzero elemnt in cell
Mostrar comentarios más antiguos
A={[3,4],[8,9],[1,2],0,0,0};
A(cell2mat(A)==0)={[]};
I used this code, but have error
Error using cat
Dimensions of arrays being concatenated are not consistent.
Error in cell2mat (line 2)
m{n} = cat(2,c{n,:});
Result should be
A={[3,4],[8,9],[1,2],[],[],[]};
Respuesta aceptada
Más respuestas (1)
Himanshu tripathi
el 28 de Jun. de 2019
0 votos
This may be helpful.
Categorías
Más información sobre Cell Arrays en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!