MATLAB: Do I get this error? If i do it in the command window it seems to be possible

errorMATLAB

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

Best Answer

Inside a for loop, you are assigning
M = M{INDEX}
That replaces all of M with the contents of one cell of M. Afterwards, M is unlikely to be a cell array.