The 'timer' class does not support code generation.

3 ビュー (過去 30 日間)
Pranav Mathur
Pranav Mathur 2019 年 2 月 25 日
回答済み: Walter Roberson 2019 年 2 月 25 日
I am trying to execute this code and the error- 'The 'timer' class does not support code generation' is cropping up along with these errors:
  1. Undefined function or variable 'start'
  2. Function 'delete' is not supported for code generation
function y = fcn(v1, v2, v3, v4)
ar=[v1,v2,v3,v4];
%step1
[~,I]=max(ar);
y=I;
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;
t = timer('TimerFcn', 'disp(''wait'')','StartDelay',15);
start t;
delete t;

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 2 月 25 日
Correct, code generation is not supported for timers. timers do not exist in the C language, and do not exist in the form you want in POSIX.1 either (because C has no interrupts.)
Some people have put together timer services for C++; see example here

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by