필터 지우기
필터 지우기

Initialize a counter used Simulink For iterator block

조회 수: 2 (최근 30일)
Jonathan
Jonathan 2019년 2월 8일
편집: Jonathan 2019년 2월 8일
Here's a simple algorithm :
index = 0
innerIndex = 0
M = a 2d matrix with zeros everywhere
for index going from 1 to 10
do some stuff involving the use of index
if a certain condition is met
increment innerIndex
append some stuff in M with something like M[innerIndex,:]=some stuff
end
end
do some stuff with M and the final value of innerIndex
I want to set this up as a Simulink model 'A' with a for iterator and Matlab embedded functions and delay blocks to do most of the work. This model will itself be called within a loop by a parent model 'B'.
I'm having a hard time making sure that lines 2 and 3 of my algorithm are done properly. I thought that the delay blocks would take care of this initialization, but apparently it doesn't. I want innerIndex and M to go back to their initial values (zero) each time model B calls model A.
Do you have suggestions, even general guide lines, as to how to tackle this in Simulink?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2013a

Community Treasure Hunt

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

Start Hunting!

Translated by