How can I Read or get the Values one by one from matrix variable or array?
3 次查看(过去 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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!