Filter löschen
Filter löschen

Error while evaluating TimerFcn for timer Cannot create variable in workspace

1 Ansicht (letzte 30 Tage)
AN
AN am 22 Dez. 2020
Beantwortet: Jan am 22 Dez. 2020
I get the error "Error while evaluating TimerFcn for timer 'simulinkcycle' Cannot create variable 'U1' in workspace" when running my timer function for a simulink simulation:
function [Sim] = Simulink_Simulation
Sim = timer('Name','simulinkcycle', ...
'Period',900, ...
'StartDelay',0, ...
'TasksToExecute',inf, ...
'ExecutionMode','fixedSpacing', ...
'TimerFcn',@SimStart);
start(Sim);
function SimStart(a,b)
sim('File.slx',100000);
end
end
The simulation in Simulink works fine when I run it via the run button or with "sim('File.slx',100000)" in the command window.

Antworten (1)

Jan
Jan am 22 Dez. 2020
What happens, if you set the TimerFcn to:
'TimerFcn', @(TimerH, EventData) sim('File.slx', 100000)

Kategorien

Mehr zu Startup and Shutdown 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!

Translated by