Subscript indices must either be real positive integers or logicals.

2 次查看(过去 30 天)
Hi, I want to make the sum in a 20x12 matrix,that consists of doubles. Some entries are zero and some not. I get the following error: Subscript indices must either be real positive integers or logicals.
can someone help?

回答(1 个)

Guillaume
Guillaume 2016-5-4
编辑:Guillaume 2016-5-4
It would help if you posted the code that causes the error. From the little information you've given (you want to sum), it's impossible to know what the problem is as summing does not involve indexing.
Unless you've committed the cardinal sin of creating a variable called sum and are then trying to call the sum function. In this case, you are not calling sum but instead indexing into your sum variable. The fix is simple, do not use sum as a variable name and
clear sum
to get rid of the offending variable.

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by