How do I export data from the embedded code?

2 views (last 30 days)
Johan Svendsen
Johan Svendsen on 18 Aug 2019
Answered: Roshni Garnayak on 21 Aug 2019
Hi everyone
I'm a building an MPC, to follow an optimal trajectory I have computed, for this I want to embed the code, using the simulink "build model" feature and eventually put it on an ETAS 910. But this is my first experience with this and I can't figure out what block can give me the control, state and reference signal as an output. The "To file" block gives me some data, but when you open the file its either corrupted or contains what I think is raw code.(I have tried export to both csv and xlsx)
Any help is much appreciated, as this is a new area for me! Thank you.
Kind regards
Johan Svendsen

Answers (1)

Roshni Garnayak
Roshni Garnayak on 21 Aug 2019
Set the following parameters under ‘Model Configuration Parameters’ (gear button available in the toolbar):
  • Code Generation -> System target file -> ert.tlc
  • Code Generation -> Interface -> MAT-file logging (check the box)
For ‘To File’ block, code generation for only RSim targets is identical to Simulink. All other embedded code generation targets support only double, one-dimensional, real signals in array with time format.
Refer to the following link to know more about the code generation capabilities of ‘To File’ block:

Community Treasure Hunt

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

Start Hunting!