How to turn SimulationOutput into a struct or similar usable format

조회 수: 23 (최근 30일)
ANTONIO BUSTOS LOPEZ
ANTONIO BUSTOS LOPEZ 2024년 3월 12일
답변: Abhas 2024년 3월 25일
A friend and I have made a functon that taking the simulation output results (out) and a struct specifying certain parameters (plot_format) as inputs would return the simulation results plotted in the format specified by the aforementioned struct plot_format.
The issue is with "out", which comes in a SimulationOutput format, when we would need it in a struct or cell fomat, in order for the function to be able to work with it.
How could we do it?
  댓글 수: 1
Paul
Paul 2024년 3월 13일
The contents of a Simulink.SimulationOutput object can be accessed with dot indexing very similar to a struct, so it's not clear to me how converting it to a struct would help. Can you show a very abbreviated version of your function so we an see what you're trying to do?

댓글을 달려면 로그인하십시오.

답변 (1개)

Abhas
Abhas 2024년 3월 25일
Hi Antonio,
To address the issue of converting simulation output data from the SimulationOutput format to a struct or cell format, which is necessary for your function to process the simulation results, you can leverage the "Data Import/Export" settings in the "Configuration Parameters" of your Simulink model. The following are the steps to Configure Data Import/Export Settings:
  1. Open Model Configuration Parameters: Open the model in Simulink. Then, navigating to the model's Simulation menu, select "Model Configuration Parameters" or click on the gear icon.
  2. Navigate to Data Import/Export: In the Configuration Parameters window, the "Data Import/Export" section on the left side should be located.
  3. Configure Output Save Format: Under the Data Import/Export settings, the option labeled "Format" is found. There, the format in which the simulation output data is to be saved can be selected. The options include "array", "structure", "structure with time", "dataset".
  4. Apply and Save: Select the preferred format and click "OK" or "Apply" to save the changes.
  5. Run Simulation: Execute the simulation with the set configuration. The output will be in the chosen format, ready for use with the function.
You may refer to the following documentation links to have a better understanding on the format of the selected output of simulation:
  1. https://www.mathworks.com/help/simulink/gui/format.html
  2. https://www.mathworks.com/help/simulink/gui/data-import-export-pane.html

카테고리

Help CenterFile Exchange에서 Sources에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by