How to access logged data from Simulink.S​imulationO​utput object by name (instead of {index})?

조회 수: 21 (최근 30일)
Hello,
I know when I log multiple signals from a Simulink simulation and stored the Simulink.SimulationOutput object in the variable "out", I can select a specific signal by writing
elements = out.logsout{1}.Values;
But is there also a way of using the name of the signal instead of the index? (I use Matlab 2022b.)
Then it would not be necessary to first check which index was assigned to which variable.
Just to clarify, when I open the logsout of the Simulink.SimulationOutput instance, in the highlighted column are the names I mean:
Thanks in advance for all helpful answers!

답변 (2개)

Nitya Patel
Nitya Patel 2023년 6월 22일
You can use the find method to do so, here is the documentation for the same: Simulink.SimulationOutput.find.
  댓글 수: 1
Sofie Brammer
Sofie Brammer 2023년 6월 22일
Thank you vrey much for your help! :)
But are you sure? Because in the documentation of the find method it still says
and the name given to the find method isthen "a level higher", so the 'logsout' and not the specific signal name... or what would I need to write to get a specific signal?

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


Haroon Zafar
Haroon Zafar 2023년 12월 5일
편집: Haroon Zafar 2023년 12월 5일
Use get method.
headind_dev_data= get(out(1,1).logsout,"heading_dev")

카테고리

Help CenterFile Exchange에서 Prepare Model Inputs and Outputs에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by