Question

I'm having an issue with the for iterator subsystem, it appears to be running twice as many iterations as it should. I have an image below of the system I've been experimenting with.

In this instance, the for iterator subsystem should run only five times, correct? It appears to be running ten times as my counter shows. When I change the width of the signal into the For Iterator block, the counter will display twice that number (e.g. if I put in ones(2, 1), the counter will display 4). The initial condition of the unit delay block is 0.

What am I not understanding about the For Iterator subsystem? Why does it seem to be running twice for every iteration?

Was it helpful?

Solution

It appears that you have the "States when starting" property set to "held" and that the simulation is running for 2 time steps. At the first simulation time step the counter counts from 0 to N, then at the second time step it counts from N to 2*N.

Change the "States when starting" property to "reset" and you'll see what you expect.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top