The workflow for logging chart local data and state self activity is similar to the workflow for logging signals in a model:
Enable signal logging for the chart and choose a logging format.
Configure states and local data for signal logging, which includes controlling how much output the simulation generates.
Simulate the chart.
Access the logged data.
See Access Logged Data.
You can also use active state output to view or log state activity data in Simulink. For more information, see About Active State Output.