MATLAB Answers

How do I collect lots of data from Simulink to MatLab Workspace with To Workspace block?

1 view (last 30 days)
Katéri Tremblay
Katéri Tremblay on 11 Aug 2021
Answered: Pavan Guntha on 31 Aug 2021
Hello,
I am discharging a battery unity with Simulink and an STM32. I am collecting voltage and current data from the discharge with the Monitoring and Tunning option in Simulink with a simulation time of 3600 seconds. I can clearly see the values of voltages and currents in my Display blocks. I can also clearly see the evolution of the data with time in my Scope block. I am using a To Workspace block to pass the data from Simulink to MatLab. My To Workspace blocks are called Voltage and Courant (for currents). I have tried all the save formats proposed by the block to pass my data from Simulink to MatLab and nothing works... My To Workspace sampled time is 1 second. I would like if anyone could help me with this problem.
Best regards, Katéri Tremblay

Answers (1)

Pavan Guntha
Pavan Guntha on 31 Aug 2021
Hello Katéri Tremblay,
One of the possible solutions is to use 'Output' blocks and log the outputs into workspace variables through 'Model Configuration Settings'. In the figure below, 2 outputs (Output1 & Output2) represent the data to be logged into workspace.
By configuring the model settings as shown below, we could log the outputs into 'out.yout' in the MATLAB workspace.
For more details on Model Configuration settings, you could have a look at the following documentation page:
Hope this helps!

Community Treasure Hunt

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

Start Hunting!