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

1,015 次查看(过去 30 天)
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 个评论
Saravanan
Saravanan 2022-12-9
编辑:Saravanan 2022-12-9
i have some problems please help
Brace indexing is not supported for variables of this type.
Walter Roberson
Walter Roberson 2022-12-9
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

请先登录,再进行评论。

采纳的回答

Guillaume
Guillaume 2018-5-22
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 个)

Jonathan Babitsch
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 个评论
Walter Roberson
Walter Roberson 2020-5-9
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
Zakaria Aldeeb 2023-7-29
How can I solve this error?
  2 个评论
DGM
DGM 2023-7-29
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}

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by