Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Index exceeds matrix dimensions
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I applied decision tree on my LBP features but I got this error:
Index exceeds matrix dimensions. Error in Decision_Tree_Matlab_Final (line 91) labels = [labels; sprintf('%s < %2.2f', cols{best_feature}, best_val);
any idea how to solve it?
Thanks.
0 comentarios
Respuestas (1)
John D'Errico
el 29 de Jul. de 2016
Um, don't exceed the dimensions of this matrix?
READ THE ERROR MESSAGE.
Index exceeds matrix dimensions. Error in Decision_Tree_Matlab_Final (line 91) labels = [labels; sprintf('%s < %2.2f', cols{best_feature}, best_val);
The only matrix index here is for cols{best_feature}. So apparently cols is a cell array. You are trying to index into that array using the variable best_feature, and best_feature has a value that makes it exceed the dimensions of cols. READ THE ERROR MESSAGE. Think about what it tells you.
How to fix it? Find the bug in your code. We cannot know why the mis-match has occurred, because we cannot run code that we do not have, nor can we read your mind to know what the code does or what it should do. Even if you did supply the code, we still might not know what it should be doing.
So you have a bug in your code. Fix the bug. You might want to learn to use the debugger, a tremendously useful tool to step through your code, or to enable a trap for an error. Here, you actually know the line where the error occurs. You just need to do a little work to understand why it occurs.
0 comentarios
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!