error --> Brace indexing is not supported for variables of this type.

1.025 visualizaciones (últimos 30 días)
Hi Everyone, I have got this error ''Brace indexing is not supported for variables of this type.'' Actually, I don't know what does mean?
Thanks for your help!
  11 comentarios
Saravanan
Saravanan el 9 de Dic. de 2022
Editada: Saravanan el 9 de Dic. de 2022
i have some problems please help
Brace indexing is not supported for variables of this type.
Walter Roberson
Walter Roberson el 9 de Dic. de 2022
You did not post your code and did not attach data, and you did not post information about class() and size() of your data. At this time we can only offer general assistance about what kinds of causes tend to lead to this problem, such as my discussion above at https://www.mathworks.com/matlabcentral/answers/401438-error-brace-indexing-is-not-supported-for-variables-of-this-type#comment_1433699

Iniciar sesión para comentar.

Respuesta aceptada

Guillaume
Guillaume el 22 de Mayo de 2018
What the error message means is simple, you cannot use {} to index your GroupingValue_1 because for that type of variable, {} indexing has no meaning.
It looks like your code is expecting GroupingVariable to be a cell array. It is not. You'll have to find earlier in your code why that is not the case.

Más respuestas (2)

Jonathan Babitsch
Jonathan Babitsch el 8 de Mayo de 2020
Hi everybody, I have a similar problem and I have absolutely no clue where my mistake is. I get the same error but I don´t see why. I am a beginner at Matlab from germany sitting on my bachelor thesis. WIthin the project my goal is to check whether the point is sitting in a bounding box. Therefor I check the first box, which is described by the 8 Points on the Matrix M, with all the 8 points of my component. I then move on to the next box and so on. However if I go into the second box, I get the following error:
This is my Code or at least the part I think is relevant:
Please help me as I said I´m just getting started, so it´s possible I misunderstood something completely.
Thanks a lot guys,
Johnny
  1 comentario
Walter Roberson
Walter Roberson el 9 de Mayo de 2020
You create M{1} and M{2} as containing numeric arrays.
You have
for huellkoerper=1:2
M=M{huellkoerper};
stuff
end
The first time you do that, when huellkoerper is 1, you replace the cell array M with the numeric array that was previously stored in M{1} . M is no longer a cell array. Then the next iteration, when huellkoerper you try to access M{2} but M is a numeric array rather than a cell array so that fails.
Inside your for huellkoerper=1:2 loop, you should not have
M=M{huellkoerper};
and instead where you use M, you should refer to M{huellkoerper};

Iniciar sesión para comentar.


Zakaria Aldeeb
Zakaria Aldeeb el 29 de Jul. de 2023
How can I solve this error?
  2 comentarios
DGM
DGM el 29 de Jul. de 2023
Without knowing what any of the preceding code is or what type of variables these are, I'm going to just guess that maybe you mean q1{i} instead of q{i}
Zakaria Aldeeb
Zakaria Aldeeb el 29 de Jul. de 2023
I missed this. Looks like I need rest.
thank you

Iniciar sesión para comentar.

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