필터 지우기
필터 지우기

Problem using timer in code

조회 수: 4 (최근 30일)
Pranav Mathur
Pranav Mathur 2019년 2월 25일
답변: Walter Roberson 2019년 2월 25일
I'm trying to execute this function in matlab/simulink but the following errors are cropping up:
  1. The 'timer' class does not support code generation.
  2. Undefined function or variable 'start'.
  3. Function 'delete' is not supported for code generation.
I want this program to wait for some time(say 15 sec) after step 1, then execute step 2 and wait again, similarly wait after executing step 3.
function y = fcn(v1, v2, v3, v4)
ar=[v1,v2,v3,v4];
%step1
[~,I]=max(ar);
y=I+1;
t = timer('TimerFcn', 'disp(''wait'')','StartDelay',15);
start t;
delete t;
%step2
y = 1;
t = timer('TimerFcn', 'disp(''wait'')','StartDelay',15);
start t;
delete t;
%step3
[~,I1]=min(ar);
y=I1+1;
t = timer('TimerFcn', 'disp(''wait'')','StartDelay',15);
start t;
delete t;

채택된 답변

Walter Roberson
Walter Roberson 2019년 2월 25일
You would have to turn off all accleration, in order to turn off code generation.
However, you are using very much the wrong approach.

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by