Real-Time Interface between App in AppDesigner and Simulink using parsim – Error: not enough input arguments @(x)addlistener
More questions to the topic.
https://de.mathworks.com/matlabcentral/answers/2173224-real-time-interface-between-app-in-appdesigner-and-simulink-using-parsim#answer_1558008
Error using nhf>@(x)addlistener(x,’SimulationOutput’,’PostSimFcn’,listener) (line 233)
Not enough input arguments.
in my simulink-modell i do the following. Is something wrong here?
Should i write listener = @nhf (Class)?
This function run in nhf (Class)
function Simulate(obj)
for simNr = numel(obj.Data):-1:1
in(simNr) = Simulink.SimulationInput(obj.simModel);
for prop = fieldnames(obj.Data(simNr))’
in(simNr) = in(simNr).setVariable(char(prop), obj.Data(simNr).(char(prop)));
% tbd: assign to baseworkspace
% assignin(‘base’,char(prop), obj.Data(simNr).(char(prop)));
end
if isdeployed
in(simNr) = simulink.compiler.configureForDeployment(in(simNr));
end
end
% – Disable the automatic opening of the visualization viewer
% – Should be done for all models before compiling
% ————————————————————-
%open_system(obj.simModel);
%set_param(obj.simModel, ‘SimMechanicsOpenEditorOnUpdate’, ‘off’);
% Set up the listener for progress updates
listener = @(src,event) updateProgress(app,event);
% Save results internally
obj.simOut = parsim(in, …
‘ShowProgress’,’on’,…
‘TransferBaseWorkspaceVariables’,’on’,…
‘SetupFcn’,@(x) addlistener(x, ‘SimulationOutput’, ‘PostSimFcn’, listener));
What is wrong in the function (‘SetupFcn’, @(x) addlistener(x, ‘SimulationOutput’, ‘PostSimFcn’, listener) ?
Is the function in simulink wrong?More questions to the topic.
https://de.mathworks.com/matlabcentral/answers/2173224-real-time-interface-between-app-in-appdesigner-and-simulink-using-parsim#answer_1558008
Error using nhf>@(x)addlistener(x,’SimulationOutput’,’PostSimFcn’,listener) (line 233)
Not enough input arguments.
in my simulink-modell i do the following. Is something wrong here?
Should i write listener = @nhf (Class)?
This function run in nhf (Class)
function Simulate(obj)
for simNr = numel(obj.Data):-1:1
in(simNr) = Simulink.SimulationInput(obj.simModel);
for prop = fieldnames(obj.Data(simNr))’
in(simNr) = in(simNr).setVariable(char(prop), obj.Data(simNr).(char(prop)));
% tbd: assign to baseworkspace
% assignin(‘base’,char(prop), obj.Data(simNr).(char(prop)));
end
if isdeployed
in(simNr) = simulink.compiler.configureForDeployment(in(simNr));
end
end
% – Disable the automatic opening of the visualization viewer
% – Should be done for all models before compiling
% ————————————————————-
%open_system(obj.simModel);
%set_param(obj.simModel, ‘SimMechanicsOpenEditorOnUpdate’, ‘off’);
% Set up the listener for progress updates
listener = @(src,event) updateProgress(app,event);
% Save results internally
obj.simOut = parsim(in, …
‘ShowProgress’,’on’,…
‘TransferBaseWorkspaceVariables’,’on’,…
‘SetupFcn’,@(x) addlistener(x, ‘SimulationOutput’, ‘PostSimFcn’, listener));
What is wrong in the function (‘SetupFcn’, @(x) addlistener(x, ‘SimulationOutput’, ‘PostSimFcn’, listener) ?
Is the function in simulink wrong? More questions to the topic.
https://de.mathworks.com/matlabcentral/answers/2173224-real-time-interface-between-app-in-appdesigner-and-simulink-using-parsim#answer_1558008
Error using nhf>@(x)addlistener(x,’SimulationOutput’,’PostSimFcn’,listener) (line 233)
Not enough input arguments.
in my simulink-modell i do the following. Is something wrong here?
Should i write listener = @nhf (Class)?
This function run in nhf (Class)
function Simulate(obj)
for simNr = numel(obj.Data):-1:1
in(simNr) = Simulink.SimulationInput(obj.simModel);
for prop = fieldnames(obj.Data(simNr))’
in(simNr) = in(simNr).setVariable(char(prop), obj.Data(simNr).(char(prop)));
% tbd: assign to baseworkspace
% assignin(‘base’,char(prop), obj.Data(simNr).(char(prop)));
end
if isdeployed
in(simNr) = simulink.compiler.configureForDeployment(in(simNr));
end
end
% – Disable the automatic opening of the visualization viewer
% – Should be done for all models before compiling
% ————————————————————-
%open_system(obj.simModel);
%set_param(obj.simModel, ‘SimMechanicsOpenEditorOnUpdate’, ‘off’);
% Set up the listener for progress updates
listener = @(src,event) updateProgress(app,event);
% Save results internally
obj.simOut = parsim(in, …
‘ShowProgress’,’on’,…
‘TransferBaseWorkspaceVariables’,’on’,…
‘SetupFcn’,@(x) addlistener(x, ‘SimulationOutput’, ‘PostSimFcn’, listener));
What is wrong in the function (‘SetupFcn’, @(x) addlistener(x, ‘SimulationOutput’, ‘PostSimFcn’, listener) ?
Is the function in simulink wrong? startfcn, addlistener, listener, parsim, exec_event_listener, appdesigner, simulink MATLAB Answers — New Questions