How to create an array in Simulink to save data and process these data in Simulink
173 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dear all,
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.
Di
0 comentarios
Respuestas (2)
Rhea Chandy
el 5 de En. de 2021
Hi!
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.
Tamir Suliman
el 24 de En. de 2023
you can use the "To Workspace" block to save data to a variable in the MATLAB workspace. You can then use the "From Workspace" block to bring the data back into a Simulink model for further processing.
- To save data to an array, place a "To Workspace" block in your model.
- In the block's parameters, specify the variable name you want to use for the array (e.g. "myArray") and the "Save format" (e.g. "Array").
- Connect the signal you want to save to the input of the "To Workspace" block.
- To bring the data back into the model, place a "From Workspace" block in your model.
- In the block's parameters, specify the same variable name you used in step 2 (e.g. "myArray").
- Connect the output of the "From Workspace" block to the input of the block where you want to process the data.
Then you can use standard simulink block to process these data.
0 comentarios
Ver también
Categorías
Más información sobre Sources en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!