convert a matrix with some zero elments to an array with non-zero elments ?
이전 댓글 표시
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
채택된 답변
추가 답변 (1개)
Andrei Bobrov
2011년 12월 28일
B = nonzeros(A.');
카테고리
도움말 센터 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!