How shall i print whole numbers with a time delay of 1 sec???the below program display random numbers with time delay.I want to print the sequence of numbers with timer delay.

조회 수: 2 (최근 30일)
>> t=timer('timerfcn',@(x,y)disp(rand),'executionmode','fixedrate','period',1)
t =
Timer Object: timer-39
Timer Settings
ExecutionMode: fixedRate
Period: 1
BusyMode: drop
Running: off
Callbacks
TimerFcn: @(x,y)disp(rand)
ErrorFcn: ''
StartFcn: ''
StopFcn: ''
>> start(t)
0.8147
0.9058
0.1270
0.9134
0.6324
0.0975
0.2785
>> stop(t)

답변 (1개)

Vishnu Vardhan
Vishnu Vardhan 2019년 6월 9일
You can use the following function
r = randi([10 50],1,5)
where 10 and 50 determines the range and 1,5 determines the number of integers you want.
  댓글 수: 4
Shivank Anchal
Shivank Anchal 2019년 6월 10일
yes,1 second is the timer delay,but the above program display random number ,i want a sequence of numbers with time delay.
Vishnu Vardhan
Vishnu Vardhan 2019년 6월 10일
Replace disp(rand) with disp(randi([10 50],1,5)).Follow the first comment.

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

카테고리

Help CenterFile Exchange에서 Dialog Boxes에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by