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

993 Ansichten (letzte 30 Tage)
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 Kommentare
Saravanan
Saravanan am 9 Dez. 2022
Bearbeitet: Saravanan am 9 Dez. 2022
i have some problems please help
Brace indexing is not supported for variables of this type.
Walter Roberson
Walter Roberson am 9 Dez. 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

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Guillaume
Guillaume am 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.

Weitere Antworten (2)

Jonathan Babitsch
Jonathan Babitsch am 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 Kommentar
Walter Roberson
Walter Roberson am 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};

Melden Sie sich an, um zu kommentieren.


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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by