Index exceeds matrix dimensions

I have a file that plots results from a simulation. Ive been using it for a long time and now it has started giving me this problem:
Index exceeds matrix dimensions.
Error in Plot_Results (line 210)
title('Velocity of cycle')
The first time I run the file it works fine. But if I run it again without changing anything (and there is nothing to clear any variables in the code) it gives me that error. If I comment out every title, xlabel, and ylabel line then itll work fine and will plot the several plots I have in the file but with no titles or anything. This just started happening and I cant figure out why. The code was working just fine before this randomly started happening.
thanks

 Respuesta aceptada

Will
Will el 20 de Feb. de 2012

30 votos

Alright I figured it out. For some reason it wasnt rewriting the title variable from an old run so i just added "clear title xlabel ylabel" and that seems to have fixed it.

11 comentarios

Kiniena
Kiniena el 18 de Dic. de 2014
Thanks
Marlon Saveri Silva
Marlon Saveri Silva el 14 de Ag. de 2015
Thanks o/
Ivailo
Ivailo el 19 de En. de 2016
Thanks
Ian Adler
Ian Adler el 23 de Jun. de 2016
Thank you so much
shir shalom
shir shalom el 11 de Feb. de 2017
Thanks!
Thomas Gurnett
Thomas Gurnett el 4 de Mzo. de 2017
Cheers
Rania Ezzo
Rania Ezzo el 22 de Abr. de 2017
Thank you. This was helpful.
Edward McCarthy
Edward McCarthy el 2 de Oct. de 2017
This worked for me
Jennifer Scoular
Jennifer Scoular el 21 de Jun. de 2018
Was getting mega frustrated and this worked thanks!
Bahare Samadi
Bahare Samadi el 30 de Nov. de 2018
Thanks. It was very helpful.
Mariana Rodrigues
Mariana Rodrigues el 17 de En. de 2019
Thank you!!

Iniciar sesión para comentar.

Más respuestas (3)

Qiu
Qiu el 23 de Feb. de 2018

2 votos

I just found that I accidentally used the name "title" for a string, which confused Matlab. Try use another name.
Jacob Wicks
Jacob Wicks el 10 de En. de 2019
I had made xlabel and ylabel a variable which gave me the error about index exceeds array.
xlabel = ('time')
ylabel = ('something')
all I had to do was clear these variables
>>clear xlabel
>>clear ylabel
and use the proper syntax
xlabel('time')
ylabel('something')
Haseeb Ahmed Janjua
Haseeb Ahmed Janjua el 27 de Sept. de 2017

0 votos

whenever I create this function in editor
function r = Ymaxfinal(p,q)
r = ((-1000*p*q)/(27*(30*10^6)*0.163*(p+q)))*(p+(2*q))*((3*p(p+(2*q)))^0.5);
end
but when I call it in command window like Ymaxfinal(9,8)
it gives the error of Index exceeds matrix dimensions. plz help me

Categorías

Más información sobre Mathematics en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 20 de Feb. de 2012

Comentada:

el 17 de En. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by