How to change the parameter in Mask and run the simulation parallel

1 visualización (últimos 30 días)
Ao Yang
Ao Yang el 22 de Abr. de 2022
Comentada: Ao Yang el 25 de Abr. de 2022
I had a model which includes two subsystem and already masked. I can extrcat the parameter with Code
Simulink.Mask.get
And If I run the simulations parallel by using parsim or parfor, how can I change the parameter in Mask?
Thanks very much!

Respuestas (1)

Edric Ellis
Edric Ellis el 22 de Abr. de 2022
Given a simple model like this which has a mask with a parameter named gain_val
You need to do something like this:
mdl = 'mask_parsim';
block_name = '/MyMask';
param_name = 'gain_val';
for i = 10:-1:1
in(i) = Simulink.SimulationInput(mdl);
in(i) = setBlockParameter(in(i), [mdl block_name], param_name, ...
num2str(i));
end
out = parsim(in, 'ShowProgress', 'on');
There's more information in the doc.

Categorías

Más información sobre Green Vehicles en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by