simulation exits with error --> get simulation results

조회 수: 7 (최근 30일)
Frank
Frank 2013년 2월 16일
답변: Piotr Kluczek 2021년 4월 7일
Hi, I am using a simulation that is started from matlab with the sim() command and is stopped by an assertion within the model.
Is there a way to get the simulation results (logged signals, to workspace signals, ...)?
Cheers, Frank.

답변 (1개)

Piotr Kluczek
Piotr Kluczek 2021년 4월 7일
Hi Frank,
You probably dont need that help now, but I found a workaround (not really clean, but works):
  1. open_system(modelName); - to load a Data Inspector
  2. sim(modelName); - to register data in DI
  3. runIDs = Simulink.sdi.getAllRunIDs; - to get the IDs of all runs you made. If DI was clear at line 2. It should be scalar
  4. logsout = Simulink.sdi.exportRun(runID(end)); - this will get you logs
  5. close_system(modelName,0); - close opened model discarding changes (0 value)
This is script equivalent to opening a model, clicking run and saving only logsout = out.logsout. And closing discarding any changes. So you won't have metadata and other info from SimulationOutput structure.
I hope someone will find it usefull.
Regards, Piotr

카테고리

Help CenterFile Exchange에서 Signal Attributes and Indexing에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by