How can I Read or get the Values one by one from matrix variable or array?
조회 수: 4(최근 30일)
표시 이전 댓글
Sir or Madam,
I want to read the array variable one by one from array or matrix? How can i write the code? I want to calculate the Zero Element and Non Zero Element in the matrix?
I have use s=nnz(x);
but i want to get the values one by one and the compare and calculate the zero and nonzero element.
thank you sir/madam.
댓글 수: 0
채택된 답변
추가 답변(1개)
Sebastian Holmqvist
2012년 7월 13일
z_elem = nnz(nnz == 0)
nz_elem = nnz(nnz ~= 0)
Then do your calculations on each.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!