how to take all non zero elements product of matrix

5 次查看(过去 30 天)
how to do.

回答(1 个)

KSSV
KSSV 2016-11-9
编辑:KSSV 2016-11-9
Let A me your matrix or array.
idx = A~=0;
iwant=prod(A(idx));
idx should be an array. If not change A matrix to column using
A=A(:);
And then use the above code.

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by