Info

此问题已关闭。 请重新打开它进行编辑或回答。

how do i input this in built in funtions

1 次查看(过去 30 天)
multiply and count elements

回答(2 个)

Star Strider
Star Strider 2015-2-9
I’m not certain what you want, so I’ll venture this:
x=[3,7,2,9,4];
product_x = prod(x)
elements_x = length(x)
elements_x = numel(x)
produces:
product_x =
1512
elements_x =
5
elements_x =
5

Image Analyst
Image Analyst 2015-2-9
If m is your matrix:
theProduct = prod(m(:)); % Multiply all elements together.
theCount = numel(m); % Count the number of elements in the array.

此问题已关闭。

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by