Subscript indices must either be real positive integers or logicals.

1 Ansicht (letzte 30 Tage)
hdiba
hdiba am 4 Mai 2016
Bearbeitet: Guillaume am 4 Mai 2016
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?

Antworten (1)

Guillaume
Guillaume am 4 Mai 2016
Bearbeitet: Guillaume am 4 Mai 2016
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.

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by