sum function not working
Mostrar comentarios más antiguos
when I enter:
sum([1 2 3])
i get the error message: Index exceeds matrix dimensions.
This seems like a bug.
Respuesta aceptada
Más respuestas (2)
Dear Anthony,
How likely do you think is a bug in such a fundamental Matlab function? We have 96'559 participators in this forum currently and 7447 people have published functions in the FileExchange. Therefore I'm convinced, that there are at least 100'000 Matlab users (an extremely pessimistic estimation). During the development and testing of Matlab such a bug would have been found and if not, any of the users had reported it already.
Azzi's idea is most likely correct and "sum" is one of the most frequently shadowed built-in functions. But a redefined horzcat command could be the problem also.
Whenever such a magic behavior occurs, checking the user-defined parts is a good idea. It is typical, that such problems disappear magically after a restart of the computer or of Matlab. But this does not indicate, that the computer of Matlab caused the problem. It is the typical nature (or even the definition) of magic: Humen see relations between unrelated events.
Welcome to the forum have have fun with Matlab!
3 comentarios
Anthony
el 12 de Sept. de 2013
Jan
el 12 de Sept. de 2013
Yes, Anthony, peace!
Image Analyst
el 12 de Sept. de 2013

Image Analyst
el 30 de En. de 2017
0 votos
To find out which, if any, of your m-files overload the built-in MATLAB functions, see the attached program.
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!