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:
- Run your simulation with logging enabled for every input and output signal of the block.
- Open the Simulink Data Inspector from ‘Review Results’ section in ‘Simulation’ Tab.
- 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:
- To export data from Simulink blocks to Base Workspace - https://www.mathworks.com/help/comm/ug/export-data-to-matlab.html
- To export workspace variables - https://www.mathworks.com/help/simulink/ug/workspace-variables-in-model-explorer.html
- Simulink.findVars - https://www.mathworks.com/help/simulink/slref/simulink.findvars.html
Hope this helps you proceed further!