MATLAB: How to change the decimation for all logged signals in the model from the command line in Simulink

simulink

I would like to change the decimation for all logged signals in my model from the command line in Simulink.

Best Answer

You can change the decimation for all logged signals in a model from the command line in Simulink by using the following:
%find all ports that have data logging turned on
ports=find_system('findall','on','type','port','datalogging','on');
%set the decimation for those ports
set_param(ports,'dataloggingdecimatedata','on','dataloggingdecimation',num2str(value));