The "unique" function returns "Index exceeds matrix dimensions" error
Mostrar comentarios más antiguos
I have a .mat file loaded in the Workspace. I execute the command
unique = unique(datafile.data(:,2));
It creates the unique array successfully. When I execute the very same command for a second time, what should happen? The array 'unique' should be created again and the one in the Workspace should be replaced. No, instead, I get the error 'Index exceeds matrix dimensions.' If I assign the statement to a different name like
a = unique(datafile.data(:,2));
I get the same error. So the first time I execute the command, no problem. The second time I execute it, I get the error. What is going on?
1 comentario
You redefine unique to be a variable:
unique = unique(..)
so of course MATLAB tries to access that variable the next time you use the name unique.
Respuesta aceptada
Más respuestas (1)
Snoopy
el 14 de Abr. de 2017
0 votos
Categorías
Más información sobre Creating and Concatenating Matrices 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!