Effacer les filtres
Effacer les filtres

How to use an output form simulink block as i/p in a for-loop matlab function call block without errors. ?

1 vue (au cours des 30 derniers jours)
When I take continuous signal I/p from simulink block to use it in a for loop inside an m.file functional block code, then matlab prompts problem that (Index exceeds array dimensions. Index value 2 exceeds valid range [1-1] of array ADC_Va.) ADC_Va is the signal which I use as i/p in for loop matlab function call. for the first iteration it works but when loop increments then above messege prompts. anyone has any idea ?

Réponses (1)

Walter Roberson
Walter Roberson le 8 Nov 2018
Simulink signals have specific times associated with them, and at any one simulated time, only the signal value associated with that time is available to be read from the signal connection.
You would need to buffer the signal to however many steps you need to use the series of values in a for loop. That would of course introduce equivalent delay.

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by