Simulink: How to use a structure as output signal?

조회 수: 34 (최근 30일)
Gurkenglas
Gurkenglas 2015년 2월 4일
답변: Jason Moore 2015년 2월 7일
Hi,
I have many signals in my simulink modell, that I want to convert into a structure. So I use a matlab function block, that looks like this:
function mystruct = create_struct( u )
mystruct.a = u(1);
mystruct.b = u(2);
end
Then I want to use this "struct-output" as input for another function. But this seems not to work. Have you any idea how to solve this? Thanks

채택된 답변

Jason Moore
Jason Moore 2015년 2월 7일
In Simulink structured data is represented as Simulink.Bus objects to create a Simulink Bus you can do this by typing in your workspace
varname = Simulink.Bus
After creating a bus in your Simulink model use this bus object as your datatype for your Simulink block port.

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by