Problem using timer in code
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Pranav Mathur
am 25 Feb. 2019
Beantwortet: Walter Roberson
am 25 Feb. 2019
I'm trying to execute this function in matlab/simulink but the following errors are cropping up:
- The 'timer' class does not support code generation.
- Undefined function or variable 'start'.
- 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;
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 25 Feb. 2019
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Whos finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!