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

3 次查看(过去 30 天)
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
  7 个评论
Walter Roberson
Walter Roberson 2020-5-9
Your code does not use M after the M=M{huellkoerper}; line, so it is difficult to understand how M fits with the rest of your code.
My idea is now to create different Matrix M1,M2 and the use huellkoerper again to count it up in a for loop. But instead of having a cell array I am going to say if huellkoerper is 1 use M1, elseif 2 use M2 and so on
NO! Just use M{huellkoerper} in the part of your code that you want the appropriate matrix!
Jonathan Babitsch
Wow you are right the solution is changing M=M{huellkorper}; to just M{huellkoerper};
So that's what you meant earlier I just wasn't getting it...
Thank you a lot Walter you are a genius! Helped me out a lot! That was a lot easier than I expected. Big thank you once again! Hope I can count on your advice if I need it again in the future.
Have a nice weekend,
Johnny

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2020-5-8
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by