Simple for loop in Simulink

2 次查看(过去 30 天)
Gazi Taspinar
Gazi Taspinar 2021-4-8
Hello,
I have a R matrix whose dimension is Nx3. N will be given by user. How can I implement following Matlab code in simulink without using Matlab function block? I want to use for loop.
R=zeros(N,3)
dR=zeros(N-1,3)
for i=1:1:N-1
dR(i,:)=R(i+1,:)-R(i,:)
end
%% THANKS

回答(1 个)

Abhishek Gupta
Abhishek Gupta 2021-4-12
Hi,
You can use a For Iterator Subsystem block. Referring to the following documentation, which might help you achieve the mentioned task: -

类别

Help CenterFile Exchange 中查找有关 Simulink Environment Customization 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by