How to input an array in my simulink model?

조회 수: 13 (최근 30일)
Lily
Lily 2025년 2월 25일
답변: Aabha 2025년 2월 28일
I want to use an array as a parameter of my c function caller and have it as a bus element. I try to define it in my data dictionary but it does not show up as a data type for my bus element.
How do I properly define an array in simulink modeling?

답변 (1개)

Aabha
Aabha 2025년 2월 28일
Hi @Lily,
I understand that you want to pass an array into a C function block within a Simulink model, and this array is part of the bus structure defined in the data dictionary.
The “C-Caller” block allows to configure input ports and parameters based on the data types that are passed as input arguments to the blocks. In order to pass a “bus element” to a block, the “Type” field in the “C-Caller” interface needs to be configured as a Bus object.
Alternatively, if the data needs to be passed as an array, and not as a bus element, the “Bus Selector” block can be used. Configure the input of the “Bus Selector” block as the bus object and configure the output as the desired array. The output of the “Bus Selector” block can then be connected as an input to the “C Caller” block.
Please refer to the following documentation links for more information about the “C-Caller” and the “Bus Selector” block.
I hope this helps.

카테고리

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

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by