convert a matrix with some zero elments to an array with non-zero elments ?
Mostra commenti meno recenti
Hi all
I have a matrix 'A' including some elments equal to zero. i want to make an array 'B' with the non-zero elements of A . for example:
A = [46 0 23;10 73 0; 0 57 13]
B=[46 23 10 73 57 13]
How can I write this program?
Thanks
Risposta accettata
Più risposte (1)
Andrei Bobrov
il 28 Dic 2011
B = nonzeros(A.');
Categorie
Scopri di più su Matrices and Arrays in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!