I'm running the simulation from the Matlab script via sim() and I need to read output variables and since model is hierachivsl - how can I access the resulting values?
The values I want ot get are at subsystem:
global_model/control_loop with variable at "Out" port 6, named "my_estim"
and within Variant subsystem
global_model/plant/Variant Subsystem1/Lumped (abc_param) at port 8, named "my_ctrl"
running the model from cmd line: simout = sim("global_model.slx");
how to read these variables out of simout aka plot(simout.yout.get('my_estim').Values);
how to read these variables?

 채택된 답변

Fangjun Jiang
Fangjun Jiang 2025년 2월 20일

0 개 추천

You need to click that signal line, right click, select properties, and then give it a name and log the signal. Once done that, the signal logging will be saved in the simout file.

댓글 수: 5

Peter
Peter 2025년 2월 24일
편집: Peter 2025년 2월 24일
>> out1 = sim("global_model.slx");
>> plot(out1.yout.get('estim').Values)
Dot indexing is not supported for variables of this type.
>>
>> res = get(out1,'estim')
Error using matlab.graphics.Graphics/get
Unrecognized property estim for class matlab.ui.Root.
>>
can't get access it :(
Sam Chak
Sam Chak 2025년 2월 24일

Can you screenshot the Simulink block diagram and highlight the signal you wish to access. It makes it earlier for us to guide you.

Peter
Peter 2025년 2월 24일
Peter
Peter 2025년 2월 24일
편집: Peter 2025년 2월 24일
I want to run multiple simulations with different configurations and then compare results on "Theta_elec_estim" vs. "Theta_elec_plant" vs. ""Theta_elec_ctrl"
aka
Fangjun Jiang
Fangjun Jiang 2025년 2월 24일
'estim' is not logged. Right click the signal line, checkmark to log the signal.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Event Functions에 대해 자세히 알아보기

제품

릴리스

R2024b

질문:

2025년 2월 20일

댓글:

2025년 2월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by