How do I product elements of a vector?
6 次查看(过去 30 天)
显示 更早的评论
Hi,
I have this matrix (3000 by 2) and I want the product of a range of elements in the second column. All of the elements are equal to 0.99 in a initial stage, but its gonna change after some further steps. I tried to use 'prod' but it didn't work...
Ex. matrix named 'aux'
prod(aux(2500,2):aux(2700,2)); It always returns me 0.99 no matter the range...
How do I do it?
tks
回答(1 个)
Azzi Abdelmalek
2013-10-22
编辑:Azzi Abdelmalek
2013-10-22
A = [71 2; 72 2; 73 2; 74 2; 75 2];
prod(A(2:4,2))
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!