So the main issue you are experiencing is related to the for loop paired with the assignment blocks. When an assignment block is placed in a for loop the first Y0 value that is entered into the assignment block is used throughout every iteration, that's why you are getting the three in the upper left corner in your displayed data, because the first Y0 into the "Assignment1" block is the first output of the "Assignment" block. Now on to the solution for the problem you show above. Utilize the two dimensional functionality of the assignment block by saying that you want these values in both columns. See the image attached for the solution.
Simulink - Matrix assignment problem
8 次查看(过去 30 天)
显示 更早的评论
Hello,
I'm currenttly facing a problem, that I'm not able to solve.

The image shows a simple example of my problem. I have a 2D-matrix that I want to fill with values using a for loop. But as you can see the matrix is not filled with the values I expected. What am I doing wrong? Surprisingly for me is, that the assignment of a 1D-vector is working correctly. To solve the problem, I can not use a matlab function block because this is not allowed for my work.
Thanks in advance.
Best Regards
Frank
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Array and Matrix Mathematics 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!