Borrar filtros
Borrar filtros

how to define exactly where the error is

4 visualizaciones (últimos 30 días)
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD el 31 de Dic. de 2017
Comentada: MAHMOUD ALZIOUD el 1 de En. de 2018
Happy new year guys, I have a simple question please, I am writing a code in a for loop and it still gives me an error saying Index exceeds matrix dimensions. and it refers to a line that doesn't have matrix in it ! so seems like this is not the line with the error, how can i please track exactly where the error is?

Respuesta aceptada

Walter Roberson
Walter Roberson el 31 de Dic. de 2017
At the command line, try giving the command clear with the function name, like
clear azl_assignment_7
This will remove any copies of the code that it has in memory. This can be needed if you modify code outside of the MATLAB editor, or if you write code files in the program and want to execute the code, or if you had taken the handle of the function in the past.
The only other time I have seen it give the wrong line number was cases where the code had a syntax error, in which case sometimes it gets the wrong line in reporting about the syntax error -- but in such cases the code will not execute at all.
  9 comentarios
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD el 1 de En. de 2018
Amazing as usual Mr Walter, thank you very much for your wonderful help. you made sense in many points you mentioned and I will take them into consideration, thank you for the clean up code. and happy new year for you and your blessed family.
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD el 1 de En. de 2018
I just tried it and it worked well, Thank you again very much for pointing out the error source, you were right, I added 2 more columns to class 10.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by