How can I start data logging for a special signal at a special time with matlab code?

11 次查看(过去 30 天)
I want to log a signal in simulink for a time x. I am interested for a special point of time as soon a definded error value is reached. Is there any possibility to control the signal logging start time via matlab code. So that e.g. the signal logging begins at simulation time 3600 seconds? Backround is that the simulation runs very long and the needed memory for the logged signal is limited. So I want to log the signal later and ignore the time area which os not important for my analysis. Thank you in advance.

采纳的回答

Rishi
Rishi 2024-1-1
Hi Melanie,
I understand that you want to know how to log a Simulink signal for a specific time range.
This can be done by setting the 'Logging Intervals' parameter in the model configuration parameters 'Data Import/Export' pane. The logging intervals are specified as an 'n' by 2 matrix, where 'n' is the number of intervals. The number in the first column indicates the start of the logging interval, and the number in the second column indicates the end of the interval.
You can learn more about Specifying Logging Intervals from the following documentation;
Additional information about Logging Intervals can be found from this documentation:
You can also refer to the following example to learn how to set the parameters while simulating your model:
Hope this helps!

更多回答(1 个)

Melanie
Melanie 2024-2-13
Thank you @Rishi for detailled answer. Unfortunately the logging time was too long and matlab got problems with the storage or I was outside of the area I wanted to see...
I solved it in a different way. I was interested to a specific error or deviation in the signal at a specific time. The time I don't know exactly. So I used this error deviation value as a parameter for an enabled subsystem in simulink. As soon the value is reached, the subsystem is activated and write the signal data via the "write to .mat file" block to an matlab array. So after simulation I can plot this signal in the defined time windows with specific deviation value.
Regards Melanie

类别

Help CenterFile Exchange 中查找有关 Save Run-Time Data from Simulation 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by