How to use 'pause' function in Matlab Function Block?

2 次查看(过去 30 天)
I'm able to run the following code in Matlab Command Window, which is giving me the output I'm looking for, i.e. printing the respective elements of matrix x and y after a three second gap:
x = [1 2 3];
y = [4 5 6];
x(1)
y(1)
pause(3);
x(2)
y(2)
pause(3);
x(3)
y(3)
However, I want a Matlab Function Block to process this code and display the answers in a 'display' block in Simulink. I set up the following model:
I'm able to run this code too, but the output is displayed in the Matlab Command Window (shown below), and not the 'display' blocks. Also, the code runs till the simulation time is over and this gives the required output multiple times. Is there any way to run the simulation only once?

回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by