Real time in SIMULINK

Hello,
I would like to ''read'' some numbers throughout the simulation, in specific period time. How can i do it?? Any suggestions??
My input has a 17001 numbers.
I would like to read numbers between:
- 1400:1800
- 2800:3300
- 4000:4400
- 5400:5800
- 6800:7100
- 8100:8600
- 9400:9600
- 10800:11200
- 11700:11900
- 13000:13800
- 14600:15100
- 16000:16400
Between this numbers, i have to found the minimum of it.
Any suggestions??
Thanks, Miha

 채택된 답변

TAB
TAB 2012년 6월 20일

0 개 추천

Sources/Clock returns the current model simulation time.
You can use this block to get simulation time, and by comparing the simulation time with required time values, you can read the numbers in specific periods.

댓글 수: 2

Miha
Miha 2012년 6월 20일
thanks, for answer...I have a Matlab Simulink function block....and i wrote thih code, witch has to work in simulation time (1.7s or 17001 numbers)....
for j1 = 1400:1800
if j1==1400;
minimum1=Pr_C(j1);
if minimum1>Pr_C(j1)
minimum1=Pr_C(j1);
mesto1=j1;
end
end
end
% 2.odcep---------------------------------------------------------
for j2 = 2800:3300
if j2==2800;
minimum2=Pr_C(j2);
if minimum2>Pr_C(j2)
minimum2=Pr_C(j2);
mesto2=j2;
end
end
end
% 3.odcep---------------------------------------------------------
for j3 = 4000:4400
if j3==4000;
minimum3=Pr_C(j3);
if minimum3>Pr_C(j3)
minimum3=Pr_C(j3);
mesto3=j3;
end
end
end
% 4.odcep---------------------------------------------------------
for j4 = 5400:5800
if j4==5400;
minimum4=Pr_C(j4);
if minimum4>Pr_C(j4)
minimum4=Pr_C(j4);
mesto4=j4;
end
end
end
% 5.odcep---------------------------------------------------------
for j5 = 6800:7100
if j5==6800;
minimum5=Pr_C(j5);
if minimum5>Pr_C(j5)
minimum5=Pr_C(j5);
mesto5=j5;
end
end
end
% 6.odcep---------------------------------------------------------
for j6 = 8100:8600
if j6==8100;
minimum6=Pr_C(j6);
if minimum6>Pr_C(j6)
minimum6=Pr_C(j6);
mesto6=j6;
end
end
end
% 7.odcep---------------------------------------------------------
for j7 = 9400:9600
if j7==9400;
minimum7=Pr_C(j7);
if minimum7>Pr_C(j7)
minimum7=Pr_C(j7);
mesto7=j7;
end
end
end
% 8.odcep---------------------------------------------------------
for j8 = 10800:11200
if j8==10800;
minimum8=Pr_C(j8);
if minimum8>Pr_C(j8)
minimum8=Pr_C(j8);
mesto8=j8;
end
end
end
% 9.odcep---------------------------------------------------------
for j9 = 11700:11900
if j9==11700;
minimum9=Pr_C(j9);
if minimum9>Pr_C(j9)
minimum9=Pr_C(j9);
mesto9=j9;
end
end
end
% 10.odcep---------------------------------------------------------
for j10 = 13000:13800
if j10==13000;
minimum10=Pr_C(j10);
if minimum10>Pr_C(j10)
minimum10=Pr_C(j10);
mesto10=j10;
end
end
end
% 11.odcep---------------------------------------------------------
for j11 = 14600:15100
if j11==14600;
minimum11=Pr_C(j11);
if minimum11>Pr_C(j11)
minimum11=Pr_C(j11);
mesto11=j11;
end
end
end
% 12.odcep---------------------------------------------------------
for j12 = 16000:16400
if j12==16000;
minimum12=Pr_C(j12);
if minimum12>Pr_C(j12)
minimum12=Pr_C(j12);
mesto12=j12;
end
end
end
C=min([
minimum1,
minimum2,
minimum3,
minimum4,
minimum5,
minimum6,
minimum7,
minimum8,
minimum9,
minimum10,
minimum11,
minimum12])
The problem is, how can I set FUNCTION BLOCK that start read in 0.14 s to 0.18 s or (1400 to 1800).....???
With clock???
Thanks, MIHA
TAB
TAB 2012년 6월 20일
Put your embedded matlab function block inside the Enabled subsystem.
Enabled this subsystem when output of Clock is between 0.14s to 0.18s.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Modeling에 대해 자세히 알아보기

제품

질문:

2012년 6월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by