Running code inspector with a For Loop Iterator
17 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a model running with a For Iterator (to read an Input Array and write some of its datas to another one shorter array).
The model must go through both Model Advisor and Code Inspector to be embedded in the calculator.
As for the Model Advisor everything is passed and generated code is about 120 lines, however when I try to run the code inspector, it runs for more than 2.5hrs (on the inspection only) and I am forced to kill the Matlab task afterward because it stops running. Here is a screenshot of the model.
Here is what I tried:
- include the "add" and the "unitDelaty" inside the referenced model => it creates an algebraic loop
- add the triggered block within a referenced model => impossible as it contain an "assignement" block and therefore cannot be referenced.
- Simplify the referenced model to reduce load capacity of the model containg.
I can provide the generated C code if necessary
Thank you,
0 个评论
回答(1 个)
Debadipto
2024-3-28
It's difficult to tell exactly what's causing the Code Inspector to slow down by just looking at the model. Could you please check if the iteration count, denoted by the parameter 'N' in the For Iterator, is not set too high?
I recommend reaching out to MathWorks Technical Support for further assistance with this issue:
https://www.mathworks.com/support/contact_us.html
3 个评论
Davide Scarabattoli
2024-6-11
编辑:Davide Scarabattoli
2024-6-11
Hello,
I have the same problem (with revision 2023b). After a month of testing with “technical support” it turns out that it is a known issue. In general code inspector (SLCI), with iterators has serious problems. This is because it executes all iterations of the loop (For or While), allocating an incredible amount of memory (in my case I had a loop of 4192 elements).
Mathworks technical support did not give a solution to this problem.
I can tell you that the original issue number is 3302091.
We for SW compatibility reduced the loop to 12 iterations to validate with SLCI and then regenerate the final code with the correct number of iterations. Horrible solution, but I think it is the only viable one (for the time being).
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Model Compatibility 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!