Simulink Export Variable List

5 views (last 30 days)
Semaj Kazam
Semaj Kazam on 29 Feb 2024
Answered: T.Nikhil kumar on 14 Mar 2024
I am trying to Export variables in a block to a list, inputs and outputs for use in another program.
This should be simple, yes? Export is greyed out.
I also tried to use Find Referenced Variables and get an error.
What is the best way to output a list of variables, excluding commands? Tutorial does not show this.

Answers (1)

T.Nikhil kumar
T.Nikhil kumar on 14 Mar 2024
Hello Semaj,
Based on your question, I can comprehend that you want to obtain a list of a Simulink block's inputs and outputs.
I would suggest you to try the below mentioned methods which may help you:
  • You can try using the ‘To Workspace’ Simulink block to log both input and output data into the workspace. This data in workspace can then be converted to required format.
  • "Export" is generally greyed out when there are no variables in the workspace. Try right-clicking on the model’s name and select ‘Find Referenced Variables’. Then select all the variables and export selections to a .mat file.
  • The error regarding failure in compiling on using ‘Find Referenced Variables’ could be due to some unresolved issues in the model. Ensure that your model is correctly set up and that all errors in Diagnostic Viewer are resolved.
  • If your goal involves exporting simulation data (i.e., the outputs of your model over time), then the Simulink Data Inspector provides a straightforward way to export such data. Use it instead of the Model Explorer to log variables:
  1. Run your simulation with logging enabled for every input and output signal of the block.
  2. Open the Simulink Data Inspector from ‘Review Results’ section in ‘Simulation’ Tab.
  3. Use the export functionality within the Data Inspector to save the data to the workspace or a file.
Refer to the following documentation for more details:
Hope this helps you proceed further!

Tags

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!