for loop system in simulink
8 views (last 30 days)
Show older comments
how can use the for loop in Simulink in order to scrollin through the different row of a matrix?
i'm trying to evaluate the different result of linear equations where my values are in vector and in matrix.
thank you in advance
1 Comment
Mathieu NOE
on 9 Nov 2023
hello
you can access a matrix rows or columns data several ways , but why the need for a for loop ?
Answers (1)
SOUMNATH PAUL
on 23 Nov 2023
Hi,
As per my understanding, you want to use for loop iterator for going through the different rows of a matrix which allows you to evaluate linear equations for each row of the matrix.
Here are some suggestions that you can follow to implement the iterator:
- Build a matrix block for giving input to your subsystem.
- Use “For Each Subsystem” block.
- Connect the input to the above-mentioned block and go through the first link to understand how you can iterate over rows and columns based on your specific requirements.
- Place the blocks that models your linear equations inside the “For Each Subsystem” and then use the input from the block as the current row or column of your matrix.
Kindly refer to the section ”Configure the Subsystem” in the link below to get an idea of how to operate vectors and matrices using this block:
Here’s an example in SIMULINK to implement partitioning input:
You can also use the block “For Iterator Subsytem” but you must explicitly specify the number of iterations every time you use this.
Hope it helps!
Regards,
Soumnath
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!