Simulink - Matrix assignment problem
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Jaren Devey
il 24 Gen 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 Commenti
Vedere anche
Categorie
Scopri di più su Array and Matrix Mathematics in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!