MATLAB Answers

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

1,045 views (last 30 days)
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!


Show 4 older comments
Albrecht Liebenau
Albrecht Liebenau on 27 Aug 2019
yeah. im using simscape for a multi body simulation. its a kinematic model of a formula student car.
i have all coordinates in a stucture. is this maybe a problem?
why does the optimization process bring up this fault after a while of simulation and optimizing? its not right away.
could be the reason the solution cannot be found with the adjustments and the scaling factors?
which information do you need?
Walter Roberson
Walter Roberson on 27 Aug 2019
I think you will need to use a debugger.
If the line of code giving the error has executed correctly before then what I would look for is the possibility that a variable has become empty.

Sign in to comment.

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.

More Answers (1)

Jonathan Babitsch
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,

  1 Comment

Walter Roberson
Walter Roberson on 9 May 2020
You create M{1} and M{2} as containing numeric arrays.
You have
for huellkoerper=1:2
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
and instead where you use M, you should refer to M{huellkoerper};

Sign in to comment.

Translated by