Get names of the current Simulink Block and then store all the inputs and outptus of the block into a structure ?

조회 수: 9 (최근 30일)
How do i find all the inputs and outputs of a current simulink block and then store the inputs and outputs seperately into two seperate structure blocks in matlab script ?
ALso as you know each input and output have their Name , Data type and others .i also need to store these Name , Data type into the structure .
For example if i press Input.Input_Name = (It should give me all the Name , Data type as field to the structure)
Thank you for the help in advance .

채택된 답변

Arvind Sathyanarayanan
Arvind Sathyanarayanan 2019년 1월 21일
편집: Arvind Sathyanarayanan 2019년 1월 21일
Sachin,
You can figure out the number of ports of the current block by using the get_param() command.
blockPorts = get_param(gcb,'PortHandles'); %Generates a structure with port handle
portobj = get_param(blockPorts.inport(1),'ObjectParameters'); %Generates a structure with names of first inport properties
You can use the port handle to obtain all the other information that you require. The common block properties can be found here and block specific parametes can be found here.
  댓글 수: 1
sachin narain
sachin narain 2019년 1월 22일
Thank you so much and can you tell me also how can i get the data types of each Input to the block also using get_param blocks

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by