error --> Brace indexing is not supported for variables of this type.
1,024 views (last 30 days)
Show older comments
saman zahiri rad
on 18 May 2018
Commented: Zakaria Aldeeb
on 29 Jul 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 Comments
Walter Roberson
on 9 Dec 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
Accepted Answer
Guillaume
on 22 May 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 Comments
More Answers (2)
Jonathan Babitsch
on 8 May 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 Comment
Walter Roberson
on 9 May 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};
Zakaria Aldeeb
on 29 Jul 2023
How can I solve this error?
2 Comments
DGM
on 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}
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!