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

1 025 vues (au cours des 30 derniers jours)
saman zahiri rad
saman zahiri rad le 18 Mai 2018
Commenté : Zakaria Aldeeb le 29 Juil 2023
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 commentaires
Saravanan
Saravanan le 9 Déc 2022
Modifié(e) : Saravanan le 9 Déc 2022
i have some problems please help
Brace indexing is not supported for variables of this type.
Walter Roberson
Walter Roberson le 9 Déc 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

Connectez-vous pour commenter.

Réponse acceptée

Guillaume
Guillaume le 22 Mai 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.
  2 commentaires
saman zahiri rad
saman zahiri rad le 22 Mai 2018
Thanks for your answer. :-)
Jan
Jan le 22 Mai 2018
+1. I've removed my redundant answer.

Connectez-vous pour commenter.

Plus de réponses (2)

Jonathan Babitsch
Jonathan Babitsch le 8 Mai 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 commentaire
Walter Roberson
Walter Roberson le 9 Mai 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};

Connectez-vous pour commenter.


Zakaria Aldeeb
Zakaria Aldeeb le 29 Juil 2023
How can I solve this error?
  2 commentaires
DGM
DGM le 29 Juil 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 le 29 Juil 2023
I missed this. Looks like I need rest.
thank you

Connectez-vous pour commenter.

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by