To manage the size of logged data, various options are available depending on the method used for logging the signal:
1. Scope Block: When using the Scope block, the "Limit data points to last" option can be used to restrict the number of samples in the logged signal at any time. Additionally, the "Decimation" option can reduce the signal's sampling rate. More details can be found here:
web(fullfile(docroot, 'simulink/slref/scope.html#d117e218582'))

2. To Workspace and To File Blocks: Similar options are available in these blocks. Further information is available at:
web(fullfile(docroot, 'simulink/slref/toworkspace.html'))
web(fullfile(docroot, 'simulink/slref/tofile.html'))

3. Signal Logging: For signals logged through signal logging, configuration parameters in the model offer similar options. Additionally, the "Logging Intervals" option allows specifying time intervals for logging.

More information on controlling the amount of data being exported can be accessed using the following command:
web(fullfile(docroot, 'simulink/ug/limit-amount-of-exported-data.html'))
For greater control over logged signals, a custom Level-2 MATLAB S-function can be used to edit, delete, or save the logged variable in the base workspace. The following example illustrates creating a MATLAB script for an S-function:
function myStepCallback(block)
% Setup the basic S-function properties
setup(block);
end
function setup(block)
% Register the number of ports
block.NumInputPorts = 0;
block.NumOutputPorts = 0;
% Set up the sample times
block.SampleTimes = [-1 0]; % Inherited sample time
% Register the methods
block.RegBlockMethod('Outputs', @Output); % Called at each time step
end
function Output(block)
% Get the current simulation time
currentTime = get_param(bdroot, 'SimulationTime');
% Your callback code here
fprintf('Current Simulation Time: %.2f\n', currentTime);
end
In the Output(block) function, the current simulation time is displayed. This can be replaced with a script to edit, delete, or save the logged data, depending on its format. The sample time value [-1 0] indicates an inherited sample time with no offset, and Output(block) is called at each simulation time step. This script has to be saved as a .m file and the name of the script file has to be mentioned in a Level-2 MATLAB S-Function block within the model.
For more details on writing Level-2 MATLAB S-functions, refer to:
web(fullfile(docroot, 'simulink/sfg/writing-level-2-matlab-s-functions.html'))