How to read a vectore in worksapce as a signal in Simulink with variable starting index
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello!
I am working on a Simulink project that requires me to read a vector stored in Matlab workspace as a signal. But the starting index of that signal is a variable. There is another block in simulink which gives an index number as an output. This is index from where Simulink is supposed to start reading the signal.
For example I have a discrete signal stored in matlab workspace in form of 10x1 vector.
If the simulink block gives an output 5, I have to read the signal starting from the 5th index all the way up to 10th index and then back to 1st index up to 4.
If the simulink block gives an output 7, I have to read the signal starting from the 7th index all the way up to 10th index and then back to 1st index up to 6.
I hope I was able to explain my doubt well.
0 commentaires
Réponses (1)
Bharath Venkataraman
le 19 Déc 2022
I suggest using the MATLAB Function block for the index calculation. You can use the initial index and then compute the new index based on this initial index and the max index value (at which point you can switch back to an index value of 1).
You can use the computed index to access the array (loaded into a persistent variable).
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!