- In your Simulink model, drag and drop the ‘To Workspace’ block from the Simulink library. Configure the block to set Variable name, Save format and Sample time. Make sure to connect the output signal(s) that you want to record to the To Workspace block and run the simulation.
- After the simulation is complete, the data will be available in the MATLAB workspace under the name you specified in the To Workspace block's parameters.
- Use MATLAB's ‘writetable’ function to write the table to an Excel file.
- Log data to workspace from Simulink model - Simulink (mathworks.com)
- Write table to file - MATLAB writetable (mathworks.com)