필터 지우기
필터 지우기

Error while evaluating TimerFcn for timer Cannot create variable in workspace

조회 수: 1 (최근 30일)
AN
AN 2020년 12월 22일
답변: Jan 2020년 12월 22일
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.

답변 (1개)

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

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by