- Connect the output of the MATLAB Function block to a 'To Workspace' block and set the output format parameter to 'Array'.
- After the simulation completes, the 'To Workspace' block will log each 1x8 vector output generated by each execution of the block to the MATLAB base workspace. For instance, if the MATLAB Function block executes 'n' times during a simulation, an nx1x8 variable will be saved in the base workspace.
- Use the 'squeeze' function to reshape the nx1x8 variable into an nx8 matrix, where each row represents a 1x8 vector output from the MATLAB Function block.
Accumulate and store vecotr at the end of simulation
28 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Priya
am 8 Nov. 2024 um 6:14
Beantwortet: Gayatri
am 8 Nov. 2024 um 6:38
In my Simulink model, each execution of a MATLAB Function block generates an arbitrary 1x8 vector as its output. How can I accumulate and store these vectors in a single data structure by the end of the simulation?
0 Kommentare
Akzeptierte Antwort
Gayatri
am 8 Nov. 2024 um 6:38
Hi Priya,
You can use the 'To Workspace' block as follows:
For additional information on the 'To Workspace' block and the 'squeeze' function, please refer to the below documentations:
0 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!