MATLAB Answers

How to Model For loop as Simulink Model?

1 view (last 30 days)
Hello All,
Suppose I want to model the folowing logic or code in Simulink.
for i=1:10
A(i)=i
end
% ^ How to model the above logic
% This Example hoe to model in simulink
for i=1:10
if i==1
a(i)=24;
else
a(i)=1+i;
end
end

  0 Comments

Sign in to comment.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 8 Feb 2020
Use "For Iterator Subsystem"

  7 Comments

Show 4 older comments
stozaki
stozaki on 9 Feb 2020
I attached following model.
for i=1:10
if i==1
a(i)=24;
else
a(i)=1+i;
end
end
Do you solve the problem?
Upendran muni
Upendran muni on 12 Feb 2020
for i=1:10
if i==5 % Now if its equals to 5 only then
a(i)=24;
else
a(i)=1+i;
end
end
If i ==5 only ,Then how it will work..i tried

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Products


Release

R2015a

Translated by