Simulink - Matrix assignment problem
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Jaren Devey
am 24 Jan. 2018
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.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Array and Matrix Mathematics finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!