How to create an array in Simulink to save data and process these data in Simulink
조회 수: 90(최근 30일)
I want to create an array in Simulink to save the satified data and then deal with these data in Simulink. For example, there is a system made by a'step function' and a sine wave with 100 Hz frequency. The sampling frequency of this system is 1 kHz. Now, assumeing a rising edge from the step function at 0.1 s, how to capture and save the one cycle data ( the circled part in the following figure) in Simulink? Moreover, if I want to do some online calculation in Simulink with the saved data, can I use the 'MATLAB function' block as what we did in the MATLAB?
Thank you for your help.
Rhea Chandy 2021년 1월 5일
You can save data from Simulink to a MAT-file using the To File block. To save it as an array, specify the Save format parameter as Array. Further, you can specify the sample period and offset at which to collect data points using the Sample time parameter.
You can also consider writing the input signal data to a workspace using the To Workspace block, however the data will not be available until the simulation pauses or stops.